Skip to content

Commit

Permalink
fix: remove 'removeListener' as it is now deprecated (#635)(by @brian…
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Meek authored Sep 11, 2021
1 parent 1da46f5 commit f03b05b
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions src/hooks/useKeyboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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]);

Expand Down

0 comments on commit f03b05b

Please sign in to comment.