File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -50,17 +50,17 @@ export function useKeyboard() {
50
50
]
51
51
52
52
return ( ) => {
53
- if ( Keyboard . removeListener ) {
53
+ if ( typeof subscriptions ?. [ 0 ] ?. remove === 'function' ) {
54
+ // React Native >= 0.65
55
+ for ( const subscription of subscriptions ) {
56
+ subscription . remove ( )
57
+ }
58
+ } else {
54
59
// React Native < 0.65
55
60
Keyboard . removeListener ( 'keyboardWillShow' , handleKeyboardWillShow )
56
61
Keyboard . removeListener ( 'keyboardDidShow' , handleKeyboardDidShow )
57
62
Keyboard . removeListener ( 'keyboardWillHide' , handleKeyboardWillHide )
58
63
Keyboard . removeListener ( 'keyboardDidHide' , handleKeyboardDidHide )
59
- } else {
60
- // React Native >= 0.65
61
- for ( const subscription of subscriptions ) {
62
- subscription . remove ( )
63
- }
64
64
}
65
65
}
66
66
} , [ ] )
You can’t perform that action at this time.
0 commit comments