diff --git a/releases/next/docs/platform-specific-code.html b/releases/next/docs/platform-specific-code.html index 3d793e31d4e..bd0b403acbb 100644 --- a/releases/next/docs/platform-specific-code.html +++ b/releases/next/docs/platform-specific-code.html @@ -25,6 +25,11 @@ if (Platform.Version === 25) { console.log('Running on Nougat!'); +}
On iOS, the Version is a result of -[UIDevice systemVersion], which is a string with the current version of the operating system. An example of the system version is "10.3". For example, to detect the major version number on iOS:
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.
For example, say you have the following files in your project:
You can then require the component as follows:
React Native will automatically pick up the right file based on the running platform.
You can edit the content above on GitHub and send us a pull request!