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 and use this option when only small parts of a component are platform-specific.
React Native provides two ways to organize your code and separate it by Platform:
On AndroidAndroid, the Platform module can also be used to detect the version of the Android Platform in which the app is running:
On iOS, the Version is a result of -[UIDevice systemVersion], which is a string with the current version of the operating system.
When your platform-specific code is more complex, you should consider splitting the code out into separate files. React Native will detect when a file has a .ios. or .android. extension and load the relevant platform file when required from other components.
|