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 = {
13
13
14
14
getInitialState : function ( props ) {
15
15
this . viewIsInsideTabBar = false
16
+ this . keyboardWillShowEvent = undefined
17
+ this . keyboardWillHideEvent = undefined
16
18
return {
17
19
keyboardSpace : 0 ,
18
20
}
@@ -35,14 +37,13 @@ const KeyboardAwareMixin = {
35
37
36
38
componentDidMount : function ( ) {
37
39
// 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 )
40
42
} ,
41
43
42
44
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 ( )
46
47
} ,
47
48
48
49
/**
You can’t perform that action at this time.
0 commit comments