From 118b64a932bd3caa0edcde70b43951a1665990ea Mon Sep 17 00:00:00 2001 From: vaukalak Date: Mon, 22 May 2017 17:28:15 +0300 Subject: [PATCH] Add docs on platform-specific components --- docs/guides/getting-started.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/docs/guides/getting-started.md b/docs/guides/getting-started.md index d68d17c9..569fada1 100644 --- a/docs/guides/getting-started.md +++ b/docs/guides/getting-started.md @@ -117,6 +117,26 @@ if (Platform.OS === 'web') { } ``` +More significant platform differences should use platform-specific files (see +the webpack configuration above for resolving `*.web.js` files): + +For example, with the following files in your project: + +``` +MyComponent.android.js +MyComponent.ios.js +MyComponent.web.js +``` + +And the following import: + +```js +import MyComponent from './MyComponent'; +``` + +React Native will automatically import the correct variant for each specific +target platform. + ## Client-side rendering Rendering using `ReactNative`: