mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-23 20:01:01 +08:00
Move everything out of Known Issues and into more appropriate locations.
Summary: Two of the known issues have been moved to the issue tracker: * #8315 * #8316 Others have been moved into more appropriate locations, such as the `TextInput` issue to the API doc itself, and the React debugging issue to the Debugging doc. The Android-specific compatibility concerns have been dropped entirely as it does not seem like people would find these in the docs. Closes https://github.com/facebook/react-native/pull/8321 Differential Revision: D3477999 Pulled By: JoelMarcey fbshipit-source-id: dfffc9910ebf5514eb14c6aa8a9a3e70761db874
This commit is contained in:
committed by
Facebook Github Bot 3
parent
8e9e489f21
commit
0c9dba46bb
@@ -11,16 +11,14 @@ When building a cross-platform app, you'll want to re-use as much code as possib
|
||||
|
||||
React Native provides two ways to easily organize your code and separate it by platform:
|
||||
|
||||
* Using the `Platform` module.
|
||||
* Using platform-specific file extensions.
|
||||
* Using the [`Platform` module](#platform-module).
|
||||
* Using [platform-specific file extensions](#platform-specific-extensions).
|
||||
|
||||
```javascript
|
||||
import BigButton from './components/BigButton';
|
||||
```
|
||||
Certain components may have properties that work on one platform only. All of these props are annotated with `@platform` and have a small badge next to them on the website.
|
||||
|
||||
React Native will import the correct component for the running platform.
|
||||
|
||||
## Platform module
|
||||
|
||||
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. Use this option when only small parts of a component are platform-specific.
|
||||
|
||||
```javascript
|
||||
@@ -79,6 +77,7 @@ if(Platform.Version === 21){
|
||||
```
|
||||
|
||||
## 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.
|
||||
|
||||
For example, say you have the following files in your project:
|
||||
|
||||
Reference in New Issue
Block a user