mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-03-13 11:09:20 +01:00
Merge pull request #6774 from BlueWallet/keyboardsub
FIX: Keyboaard listeners were not being properly removed
This commit is contained in:
commit
f151668775
5 changed files with 30 additions and 22 deletions
|
@ -77,12 +77,11 @@ const LNDCreateInvoice = () => {
|
|||
});
|
||||
|
||||
useEffect(() => {
|
||||
// console.log(params)
|
||||
Keyboard.addListener('keyboardDidShow', _keyboardDidShow);
|
||||
Keyboard.addListener('keyboardDidHide', _keyboardDidHide);
|
||||
const showSubscription = Keyboard.addListener(Platform.OS === 'ios' ? 'keyboardWillShow' : 'keyboardDidShow', _keyboardDidShow);
|
||||
const hideSubscription = Keyboard.addListener(Platform.OS === 'ios' ? 'keyboardWillHide' : 'keyboardDidHide', _keyboardDidHide);
|
||||
return () => {
|
||||
Keyboard.removeAllListeners('keyboardDidShow');
|
||||
Keyboard.removeAllListeners('keyboardDidHide');
|
||||
showSubscription.remove();
|
||||
hideSubscription.remove();
|
||||
};
|
||||
}, []);
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ import {
|
|||
I18nManager,
|
||||
Keyboard,
|
||||
KeyboardAvoidingView,
|
||||
Platform,
|
||||
ScrollView,
|
||||
StyleSheet,
|
||||
Text,
|
||||
|
@ -63,12 +64,11 @@ const ScanLndInvoice = () => {
|
|||
});
|
||||
|
||||
useEffect(() => {
|
||||
console.log('scanLndInvoice useEffect');
|
||||
Keyboard.addListener('keyboardDidShow', _keyboardDidShow);
|
||||
Keyboard.addListener('keyboardDidHide', _keyboardDidHide);
|
||||
const showSubscription = Keyboard.addListener(Platform.OS === 'ios' ? 'keyboardWillShow' : 'keyboardDidShow', _keyboardDidShow);
|
||||
const hideSubscription = Keyboard.addListener(Platform.OS === 'ios' ? 'keyboardWillHide' : 'keyboardDidHide', _keyboardDidHide);
|
||||
return () => {
|
||||
Keyboard.removeAllListeners('keyboardDidShow');
|
||||
Keyboard.removeAllListeners('keyboardDidHide');
|
||||
showSubscription.remove();
|
||||
hideSubscription.remove();
|
||||
};
|
||||
}, []);
|
||||
|
||||
|
|
|
@ -151,11 +151,11 @@ const SendDetails = () => {
|
|||
setIsAmountToolbarVisibleForAndroid(false);
|
||||
};
|
||||
|
||||
Keyboard.addListener('keyboardDidShow', _keyboardDidShow);
|
||||
Keyboard.addListener('keyboardDidHide', _keyboardDidHide);
|
||||
const showSubscription = Keyboard.addListener(Platform.OS === 'ios' ? 'keyboardWillShow' : 'keyboardDidShow', _keyboardDidShow);
|
||||
const hideSubscription = Keyboard.addListener(Platform.OS === 'ios' ? 'keyboardWillHide' : 'keyboardDidHide', _keyboardDidHide);
|
||||
return () => {
|
||||
Keyboard.removeAllListeners('keyboardDidShow');
|
||||
Keyboard.removeAllListeners('keyboardDidHide');
|
||||
showSubscription.remove();
|
||||
hideSubscription.remove();
|
||||
};
|
||||
}, []);
|
||||
|
||||
|
|
|
@ -59,11 +59,16 @@ const WalletsImport = () => {
|
|||
|
||||
useEffect(() => {
|
||||
enableBlur();
|
||||
Keyboard.addListener(Platform.OS === 'ios' ? 'keyboardWillShow' : 'keyboardDidShow', () => setIsToolbarVisibleForAndroid(true));
|
||||
Keyboard.addListener(Platform.OS === 'ios' ? 'keyboardWillHide' : 'keyboardDidHide', () => setIsToolbarVisibleForAndroid(false));
|
||||
|
||||
const showSubscription = Keyboard.addListener(Platform.OS === 'ios' ? 'keyboardWillShow' : 'keyboardDidShow', () =>
|
||||
setIsToolbarVisibleForAndroid(true),
|
||||
);
|
||||
const hideSubscription = Keyboard.addListener(Platform.OS === 'ios' ? 'keyboardWillHide' : 'keyboardDidHide', () =>
|
||||
setIsToolbarVisibleForAndroid(false),
|
||||
);
|
||||
return () => {
|
||||
Keyboard.removeAllListeners(Platform.OS === 'ios' ? 'keyboardWillShow' : 'keyboardDidShow');
|
||||
Keyboard.removeAllListeners(Platform.OS === 'ios' ? 'keyboardWillHide' : 'keyboardDidHide');
|
||||
showSubscription.remove();
|
||||
hideSubscription.remove();
|
||||
disableBlur();
|
||||
};
|
||||
}, [disableBlur, enableBlur]);
|
||||
|
|
|
@ -38,11 +38,15 @@ const SignVerify = () => {
|
|||
const isToolbarVisibleForAndroid = Platform.OS === 'android' && messageHasFocus && isKeyboardVisible;
|
||||
|
||||
useEffect(() => {
|
||||
Keyboard.addListener(Platform.OS === 'ios' ? 'keyboardWillShow' : 'keyboardDidShow', () => setIsKeyboardVisible(true));
|
||||
Keyboard.addListener(Platform.OS === 'ios' ? 'keyboardWillHide' : 'keyboardDidHide', () => setIsKeyboardVisible(false));
|
||||
const showSubscription = Keyboard.addListener(Platform.OS === 'ios' ? 'keyboardWillShow' : 'keyboardDidShow', () =>
|
||||
setIsKeyboardVisible(true),
|
||||
);
|
||||
const hideSubscription = Keyboard.addListener(Platform.OS === 'ios' ? 'keyboardWillHide' : 'keyboardDidHide', () =>
|
||||
setIsKeyboardVisible(false),
|
||||
);
|
||||
return () => {
|
||||
Keyboard.removeAllListeners(Platform.OS === 'ios' ? 'keyboardWillShow' : 'keyboardDidShow');
|
||||
Keyboard.removeAllListeners(Platform.OS === 'ios' ? 'keyboardWillHide' : 'keyboardDidHide');
|
||||
showSubscription.remove();
|
||||
hideSubscription.remove();
|
||||
};
|
||||
}, []);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue