Fix android native modules to reference right export

This commit is contained in:
Harry Wolff 2015-10-27 09:45:34 -04:00
parent f916ec26a6
commit 63c3e531d4
1 changed files with 14 additions and 2 deletions

View File

@ -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.
});
}
...
```