Permalink
Browse files

Add a section about Platform.Version on iOS

Summary:
The docs don't have a section about `Platform.Version` on iOS, but it's available.

Very simple change. I've used the section for Android as an example.
Closes #14437

Differential Revision: D5250499

Pulled By: hramos

fbshipit-source-id: 29d1323e443fc1c5710283515c4233a192d354a0
  • Loading branch information...
zubko authored and facebook-github-bot committed Jun 15, 2017
1 parent 2cc1195 commit 390c8cf96ee0b139aafc99bb23f8a49236f05309
Showing with 13 additions and 0 deletions.
  1. +13 −0 docs/PlatformSpecificInformation.md
@@ -77,6 +77,19 @@ if (Platform.Version === 25) {
}
```
### Detecting the iOS version
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:
```javascript
import { Platform } from 'react-native';
const majorVersionIOS = parseInt(Platform.Version, 10);
if (majorVersionIOS <= 9) {
console.log('Work around a change in behavior');
}
```
## Platform-specific extensions
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.

0 comments on commit 390c8cf

Please sign in to comment.