mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-02-21 14:34:55 +01:00
FIX: Keyboaard listeners were not being properly removed
This commit is contained in:
parent
b94f809da1
commit
c0d4e63757
5 changed files with 38 additions and 22 deletions
|
@ -76,16 +76,20 @@ const LNDCreateInvoice = () => {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// console.log(params)
|
const showSubscription = Keyboard.addListener(Platform.OS === 'ios' ? 'keyboardWillShow' : 'keyboardDidShow', _keyboardDidShow,
|
||||||
Keyboard.addListener('keyboardDidShow', _keyboardDidShow);
|
);
|
||||||
Keyboard.addListener('keyboardDidHide', _keyboardDidHide);
|
const hideSubscription = Keyboard.addListener(Platform.OS === 'ios' ? 'keyboardWillHide' : 'keyboardDidHide', _keyboardDidHide,
|
||||||
|
);
|
||||||
return () => {
|
return () => {
|
||||||
Keyboard.removeAllListeners('keyboardDidShow');
|
showSubscription.remove();
|
||||||
Keyboard.removeAllListeners('keyboardDidHide');
|
hideSubscription.remove();
|
||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|
||||||
const renderReceiveDetails = async () => {
|
const renderReceiveDetails = async () => {
|
||||||
try {
|
try {
|
||||||
wallet.current.setUserHasSavedExport(true);
|
wallet.current.setUserHasSavedExport(true);
|
||||||
|
|
|
@ -5,6 +5,7 @@ import {
|
||||||
I18nManager,
|
I18nManager,
|
||||||
Keyboard,
|
Keyboard,
|
||||||
KeyboardAvoidingView,
|
KeyboardAvoidingView,
|
||||||
|
Platform,
|
||||||
ScrollView,
|
ScrollView,
|
||||||
StyleSheet,
|
StyleSheet,
|
||||||
Text,
|
Text,
|
||||||
|
@ -63,15 +64,17 @@ const ScanLndInvoice = () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
console.log('scanLndInvoice useEffect');
|
const showSubscription = Keyboard.addListener(Platform.OS === 'ios' ? 'keyboardWillShow' : 'keyboardDidShow', _keyboardDidShow,
|
||||||
Keyboard.addListener('keyboardDidShow', _keyboardDidShow);
|
);
|
||||||
Keyboard.addListener('keyboardDidHide', _keyboardDidHide);
|
const hideSubscription = Keyboard.addListener(Platform.OS === 'ios' ? 'keyboardWillHide' : 'keyboardDidHide', _keyboardDidHide,
|
||||||
|
);
|
||||||
return () => {
|
return () => {
|
||||||
Keyboard.removeAllListeners('keyboardDidShow');
|
showSubscription.remove();
|
||||||
Keyboard.removeAllListeners('keyboardDidHide');
|
hideSubscription.remove();
|
||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (walletID && wallet?.getID() !== walletID) {
|
if (walletID && wallet?.getID() !== walletID) {
|
||||||
setWallet(wallets.find(w => w.getID() === walletID));
|
setWallet(wallets.find(w => w.getID() === walletID));
|
||||||
|
|
|
@ -151,11 +151,11 @@ const SendDetails = () => {
|
||||||
setIsAmountToolbarVisibleForAndroid(false);
|
setIsAmountToolbarVisibleForAndroid(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
Keyboard.addListener('keyboardDidShow', _keyboardDidShow);
|
const showSubscription = Keyboard.addListener(Platform.OS === 'ios' ? 'keyboardWillShow' : 'keyboardDidShow', _keyboardDidShow);
|
||||||
Keyboard.addListener('keyboardDidHide', _keyboardDidHide);
|
const hideSubscription = Keyboard.addListener(Platform.OS === 'ios' ? 'keyboardWillHide' : 'keyboardDidHide', _keyboardDidHide);
|
||||||
return () => {
|
return () => {
|
||||||
Keyboard.removeAllListeners('keyboardDidShow');
|
showSubscription.remove();
|
||||||
Keyboard.removeAllListeners('keyboardDidHide');
|
hideSubscription.remove();
|
||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|
|
@ -59,15 +59,20 @@ const WalletsImport = () => {
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
enableBlur();
|
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 () => {
|
return () => {
|
||||||
Keyboard.removeAllListeners(Platform.OS === 'ios' ? 'keyboardWillShow' : 'keyboardDidShow');
|
showSubscription.remove();
|
||||||
Keyboard.removeAllListeners(Platform.OS === 'ios' ? 'keyboardWillHide' : 'keyboardDidHide');
|
hideSubscription.remove();
|
||||||
disableBlur();
|
disableBlur();
|
||||||
|
|
||||||
};
|
};
|
||||||
}, [disableBlur, enableBlur]);
|
}, [disableBlur, enableBlur]);
|
||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (triggerImport) importButtonPressed();
|
if (triggerImport) importButtonPressed();
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
|
|
@ -38,11 +38,15 @@ const SignVerify = () => {
|
||||||
const isToolbarVisibleForAndroid = Platform.OS === 'android' && messageHasFocus && isKeyboardVisible;
|
const isToolbarVisibleForAndroid = Platform.OS === 'android' && messageHasFocus && isKeyboardVisible;
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
Keyboard.addListener(Platform.OS === 'ios' ? 'keyboardWillShow' : 'keyboardDidShow', () => setIsKeyboardVisible(true));
|
const showSubscription = Keyboard.addListener(Platform.OS === 'ios' ? 'keyboardWillShow' : 'keyboardDidShow', () =>
|
||||||
Keyboard.addListener(Platform.OS === 'ios' ? 'keyboardWillHide' : 'keyboardDidHide', () => setIsKeyboardVisible(false));
|
setIsKeyboardVisible(true),
|
||||||
|
);
|
||||||
|
const hideSubscription = Keyboard.addListener(Platform.OS === 'ios' ? 'keyboardWillHide' : 'keyboardDidHide', () =>
|
||||||
|
setIsKeyboardVisible(false),
|
||||||
|
);
|
||||||
return () => {
|
return () => {
|
||||||
Keyboard.removeAllListeners(Platform.OS === 'ios' ? 'keyboardWillShow' : 'keyboardDidShow');
|
showSubscription.remove();
|
||||||
Keyboard.removeAllListeners(Platform.OS === 'ios' ? 'keyboardWillHide' : 'keyboardDidHide');
|
hideSubscription.remove();
|
||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue