diff --git a/src/components/common/Dialog.js b/src/components/common/Dialog.js index 5d3b7b9..50599d1 100644 --- a/src/components/common/Dialog.js +++ b/src/components/common/Dialog.js @@ -4,6 +4,7 @@ import { StyleSheet, View, Text, TouchableHighlight } from 'react-native' import Modal from './Modal' import Icon from './Icon' import { useGetter } from '@/store' +import { useKeyboard } from '@/utils/hooks' const styles = StyleSheet.create({ centeredView: { @@ -65,12 +66,13 @@ export default ({ children, }) => { const theme = useGetter('common', 'theme') + const { keyboardShown, keyboardHeight } = useKeyboard() const closeBtnComponent = useMemo(() => closeBtn ? : null, [closeBtn, hideDialog, theme]) return ( - + true}> {title} diff --git a/src/utils/hooks/useKeyboard.js b/src/utils/hooks/useKeyboard.js index adb2edf..45cb1b6 100644 --- a/src/utils/hooks/useKeyboard.js +++ b/src/utils/hooks/useKeyboard.js @@ -16,12 +16,12 @@ export default () => { } useEffect(() => { - Keyboard.addListener('keyboardDidShow', handleKeyboardDidShow) - Keyboard.addListener('keyboardDidHide', handleKeyboardDidHide) + const keyboardDidShow = Keyboard.addListener('keyboardDidShow', handleKeyboardDidShow) + const keyboardDidHide = Keyboard.addListener('keyboardDidHide', handleKeyboardDidHide) return () => { - Keyboard.removeListener('keyboardDidShow', handleKeyboardDidShow) - Keyboard.removeListener('keyboardDidHide', handleKeyboardDidHide) + keyboardDidShow.remove() + keyboardDidHide.remove() } }, [])