From 37566c5ec4ee0c249366fa98d6c806795fdec613 Mon Sep 17 00:00:00 2001 From: David <4661784+retyui@users.noreply.github.com> Date: Thu, 11 Nov 2021 23:50:08 +0300 Subject: [PATCH] [fix][useKeyboard] Adapt unsubscription for new EventEmitter API --- src/useKeyboard.ts | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/src/useKeyboard.ts b/src/useKeyboard.ts index 27bcf9c9..90ff5399 100644 --- a/src/useKeyboard.ts +++ b/src/useKeyboard.ts @@ -50,18 +50,7 @@ export function useKeyboard() { ] return () => { - if (Keyboard.removeListener) { - // React Native < 0.65 - Keyboard.removeListener('keyboardWillShow', handleKeyboardWillShow) - Keyboard.removeListener('keyboardDidShow', handleKeyboardDidShow) - Keyboard.removeListener('keyboardWillHide', handleKeyboardWillHide) - Keyboard.removeListener('keyboardDidHide', handleKeyboardDidHide) - } else { - // React Native >= 0.65 - for (const subscription of subscriptions) { - subscription.remove() - } - } + subscriptions.forEach((subscription) => subscription.remove()) } }, []) return {