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 https://github.com/facebook/react-native/pull/14437

Differential Revision: D5250499

Pulled By: hramos

fbshipit-source-id: 29d1323e443fc1c5710283515c4233a192d354a0
This commit is contained in:
Alexander Zubko 2017-06-15 09:19:21 -07:00 committed by Facebook Github Bot
parent 2cc1195035
commit 390c8cf96e

View File

@ -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.