replace require with es6 import in docs

Reviewed By: svcscm

Differential Revision: D2936839

fb-gh-sync-id: 7a921709a37de5e9aadf324d5438d51851326348
shipit-source-id: 7a921709a37de5e9aadf324d5438d51851326348
This commit is contained in:
Mateusz Zatorski
2016-02-14 15:02:39 -08:00
committed by facebook-github-bot-7
parent 2260d900d4
commit 3ae99d0fea
11 changed files with 35 additions and 38 deletions

View File

@@ -39,11 +39,10 @@ RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
```
'use strict';
var React = require('react-native');
var {
import React, {
View,
Image
} = React;
} from 'react-native';
class ImageBrowserApp extends React.Component {
renderImage: function(imgURI) {
@@ -100,8 +99,8 @@ Events are described in detail in [this article](docs/native-components-ios.html
Events are powerful, because they allow us to change React Native components without needing a reference to them. However, there are some pitfalls that you can fall into while using them:
* As events can be sent from anywhere, they can introduce spaghetti-style dependencies into your project.
* Events share namespace, which means that you may encounter some name collisions. Collisions will not be detected statically, what makes them hard to debug.
* As events can be sent from anywhere, they can introduce spaghetti-style dependencies into your project.
* Events share namespace, which means that you may encounter some name collisions. Collisions will not be detected statically, what makes them hard to debug.
* If you use several instances of the same React Native component and you want to distinguish them from the perspective of your event, you'll likely need to introduce some kind of identifiers and pass them along with events (you can use the native view's `reactTag` as an identifier).
The common pattern we use when embedding native in React Native is to make the native component's RCTViewManager a delegate for the views, sending events back to JavaScript via the bridge. This keeps related event calls in one place.