From f03b05bbc39bf62f7d97422e717f2998f2e1fada Mon Sep 17 00:00:00 2001 From: Brian Meek Date: Sat, 11 Sep 2021 08:20:04 -0700 Subject: [PATCH] fix: remove 'removeListener' as it is now deprecated (#635)(by @brianathere) --- src/hooks/useKeyboard.ts | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/hooks/useKeyboard.ts b/src/hooks/useKeyboard.ts index 67e3a31e1..18293801b 100644 --- a/src/hooks/useKeyboard.ts +++ b/src/hooks/useKeyboard.ts @@ -86,26 +86,19 @@ export const useKeyboard = () => { ); }; - Keyboard.addListener( + const showSubscription = Keyboard.addListener( KEYBOARD_EVENT_MAPPER.KEYBOARD_SHOW, handleOnKeyboardShow ); - Keyboard.addListener( + const hideSubscription = Keyboard.addListener( KEYBOARD_EVENT_MAPPER.KEYBOARD_HIDE, handleOnKeyboardHide ); return () => { - Keyboard.removeListener( - KEYBOARD_EVENT_MAPPER.KEYBOARD_SHOW, - handleOnKeyboardShow - ); - - Keyboard.removeListener( - KEYBOARD_EVENT_MAPPER.KEYBOARD_HIDE, - handleOnKeyboardHide - ); + showSubscription.remove(); + hideSubscription.remove(); }; }, [handleKeyboardEvent]);