diff options
author | Samuel Newman <mozzius@protonmail.com> | 2024-11-25 20:30:15 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-25 20:30:15 +0000 |
commit | b0c36383a9a7304f94c2bb19f7cc4b37e0b4f637 (patch) | |
tree | 4001655a33bb300b99dbc81096ccc27fe4f712bd /src/components/Dialog | |
parent | 6c81090021222263dbf1d546216ea0da95029738 (diff) | |
download | voidsky-b0c36383a9a7304f94c2bb19f7cc4b37e0b4f637.tar.zst |
Ensure react-native-keyboard-controller enabled state doesn't get overwritten (#6727)
* revert to prev state instead of false * add dep array * use ref counting approach * patch keyboard controller to allow changing the enabled prop * remove state from patch * change patched prop name * remove Math.max check, log if < 0 * use noop provider * rm patch, use `useRef` * Style nits * Rm on web --------- Co-authored-by: Dan Abramov <dan.abramov@gmail.com>
Diffstat (limited to 'src/components/Dialog')
-rw-r--r-- | src/components/Dialog/index.tsx | 16 |
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( { |