File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,8 @@ const KeyboardAwareMixin = {
1313
1414 getInitialState : function ( props ) {
1515 this . viewIsInsideTabBar = false
16+ this . keyboardWillShowEvent = undefined
17+ this . keyboardWillHideEvent = undefined
1618 return {
1719 keyboardSpace : 0 ,
1820 }
@@ -35,14 +37,13 @@ const KeyboardAwareMixin = {
3537
3638 componentDidMount : function ( ) {
3739 // Keyboard events
38- DeviceEventEmitter . addListener ( 'keyboardWillShow' , this . updateKeyboardSpace )
39- DeviceEventEmitter . addListener ( 'keyboardWillHide' , this . resetKeyboardSpace )
40+ this . keyboardWillShowEvent = DeviceEventEmitter . addListener ( 'keyboardWillShow' , this . updateKeyboardSpace )
41+ this . keyboardWillHideEvent = DeviceEventEmitter . addListener ( 'keyboardWillHide' , this . resetKeyboardSpace )
4042 } ,
4143
4244 componentWillUnmount : function ( ) {
43- // TODO: figure out if removeAllListeners is the right thing to do
44- DeviceEventEmitter . removeAllListeners ( 'keyboardWillShow' )
45- DeviceEventEmitter . removeAllListeners ( 'keyboardWillHide' )
45+ this . keyboardWillShowEvent . remove ( )
46+ this . keyboardWillHideEvent . remove ( )
4647 } ,
4748
4849 /**
You can’t perform that action at this time.
0 commit comments