Fix android native modules to reference right export
This commit is contained in:
parent
f916ec26a6
commit
63c3e531d4
|
@ -229,7 +229,7 @@ sendEvent(reactContext, "keyboardWillShow", params);
|
|||
JavaScript modules can then register to receive events by `addListenerOn` using the `Subscribable` mixin
|
||||
|
||||
```js
|
||||
var RCTDeviceEventEmitter = require('RCTDeviceEventEmitter');
|
||||
var { DeviceEventEmitter } = require('react-native');
|
||||
...
|
||||
|
||||
var ScrollResponderMixin = {
|
||||
|
@ -238,7 +238,7 @@ var ScrollResponderMixin = {
|
|||
|
||||
componentWillMount: function() {
|
||||
...
|
||||
this.addListenerOn(RCTDeviceEventEmitter,
|
||||
this.addListenerOn(DeviceEventEmitter,
|
||||
'keyboardWillShow',
|
||||
this.scrollResponderKeyboardWillShow);
|
||||
...
|
||||
|
@ -248,3 +248,15 @@ var ScrollResponderMixin = {
|
|||
this.props.onKeyboardWillShow && this.props.onKeyboardWillShow(e);
|
||||
},
|
||||
```
|
||||
|
||||
You can also directly use the `DeviceEventEmitter` module to listen for events.
|
||||
|
||||
```js
|
||||
...
|
||||
componentWillMount: function() {
|
||||
DeviceEventEmitter.addListener('keyboardWillShow', function(e: Event) {
|
||||
// handle event.
|
||||
});
|
||||
}
|
||||
...
|
||||
```
|
Loading…
Reference in New Issue