Module Platform-BsReactNative

type iosIdiom =
| Phone
| Pad
| TV
;

React Native provides a module that detects the platform in which the app is running. You can use the detection logic to implement platform-specific code. Use this option when only small parts of a component are platform-specific.

You can read more on Platform API usage in official docs: https://facebook.github.io/react-native/docs/platform-specific-code

Example of use

marginTop(Pt(Platform.os() == Platform.Android ? 20.0 : 0.0))
type os =
| IOS(iosIdiom)
| Android
;
exception UnknownPlatform(string);
let os: unit => os;

Raises UnknownPlatform for non-standard platforms such as "web" from react-native-web

let equals: os => bool;
exception UnknownVersion;
let version: unit => int;

Raises UnknownVersion if version is undefined, i.e. in react-native-web

type selectOptions('a) = {
ios: 'a,
android: 'a,
};
let select: selectOptions('a) => 'a;