mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-02-11 22:32:38 +08:00
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:
committed by
facebook-github-bot-7
parent
2260d900d4
commit
3ae99d0fea
@@ -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 = {
|
||||
|
||||
Reference in New Issue
Block a user