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() {
5050 ]
5151
5252 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 {
5459 // React Native < 0.65
5560 Keyboard . removeListener ( 'keyboardWillShow' , handleKeyboardWillShow )
5661 Keyboard . removeListener ( 'keyboardDidShow' , handleKeyboardDidShow )
5762 Keyboard . removeListener ( 'keyboardWillHide' , handleKeyboardWillHide )
5863 Keyboard . removeListener ( 'keyboardDidHide' , handleKeyboardDidHide )
59- } else {
60- // React Native >= 0.65
61- for ( const subscription of subscriptions ) {
62- subscription . remove ( )
63- }
6464 }
6565 }
6666 } , [ ] )
You can’t perform that action at this time.
0 commit comments