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

@@ -130,14 +130,14 @@ To make it simpler to access your new functionality from JavaScript, it is commo
* 2. int duration: The duration of the toast. May be ToastAndroid.SHORT or
* ToastAndroid.LONG
*/
var { NativeModules } = require('react-native');
import { NativeModules } from 'react-native';
module.exports = NativeModules.ToastAndroid;
```
Now, from your other JavaScript file you can call the method like this:
```js
var ToastAndroid = require('./ToastAndroid');
import ToastAndroid from './ToastAndroid';
ToastAndroid.show('Awesome', ToastAndroid.SHORT);
```
@@ -275,7 +275,7 @@ sendEvent(reactContext, "keyboardWillShow", params);
JavaScript modules can then register to receive events by `addListenerOn` using the `Subscribable` mixin
```js
var { DeviceEventEmitter } = require('react-native');
import { DeviceEventEmitter } from 'react-native';
...
var ScrollResponderMixin = {