about summary refs log tree commit diff
path: root/src/components/Dialog/index.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/Dialog/index.tsx')
-rw-r--r--src/components/Dialog/index.tsx16
1 files changed, 3 insertions, 13 deletions
diff --git a/src/components/Dialog/index.tsx b/src/components/Dialog/index.tsx
index f16a9925d..c424321be 100644
--- a/src/components/Dialog/index.tsx
+++ b/src/components/Dialog/index.tsx
@@ -11,7 +11,6 @@ import {
 } from 'react-native'
 import {
   KeyboardAwareScrollView,
-  useKeyboardController,
   useKeyboardHandler,
 } from 'react-native-keyboard-controller'
 import {runOnJS} from 'react-native-reanimated'
@@ -20,6 +19,7 @@ import {useSafeAreaInsets} from 'react-native-safe-area-context'
 import {msg} from '@lingui/macro'
 import {useLingui} from '@lingui/react'
 
+import {useEnableKeyboardController} from '#/lib/hooks/useEnableKeyboardController'
 import {ScrollProvider} from '#/lib/ScrollContext'
 import {logger} from '#/logger'
 import {isAndroid, isIOS} from '#/platform/detection'
@@ -199,20 +199,10 @@ export const ScrollableInner = React.forwardRef<ScrollView, DialogInnerProps>(
   ) {
     const {nativeSnapPoint, disableDrag, setDisableDrag} = useDialogContext()
     const insets = useSafeAreaInsets()
-    const {setEnabled} = useKeyboardController()
 
-    const [keyboardHeight, setKeyboardHeight] = React.useState(0)
-
-    React.useEffect(() => {
-      if (!isIOS) {
-        return
-      }
+    useEnableKeyboardController(isIOS)
 
-      setEnabled(true)
-      return () => {
-        setEnabled(false)
-      }
-    })
+    const [keyboardHeight, setKeyboardHeight] = React.useState(0)
 
     useKeyboardHandler(
       {