The simplest way to recognize your platform is by using the Platform module, which includes a property, Platform.OS, which tells you whether you are running Android or iOS. Let's go for a simple example. Imagine you wanted to use some monospaced font in your app. It happens that the right name for the relevant font family varies between platforms: it would be "monospace" in Android, but "AmericanTypewriter" (among others) on Apple devices. By checking Platform.OS, we can set the .fontFamily attribute of a style sheet appropriately, as in the following screenshot:
If you wanted to pick several attributes differently, you might want to use Platform.select() instead:
const headings = Platform.select({
android: { title: "An Android App", subtitle: "directly from Google" },
ios: { title: "A iOS APP", subtitle: "directly from Apple" }
});
In this case, headings.title and headings.subtitle will get the values appropriate to the current platform, either Android or iOS. Obviously, you could have managed this using Platform.OS, but this style may be shorter.