From b9452ba15ae49056666cda296def279ff7b263a9 Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Mon, 30 Sep 2024 15:15:13 +0300 Subject: [PATCH] stop auto hiding keyboard, allow scrollview props to handle --- src/components/Dialog/index.tsx | 22 +++++++++++++++------- src/components/Dialog/types.ts | 2 ++ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/components/Dialog/index.tsx b/src/components/Dialog/index.tsx index d5d92048ad..cda31bae73 100644 --- a/src/components/Dialog/index.tsx +++ b/src/components/Dialog/index.tsx @@ -1,9 +1,8 @@ import React, {useImperativeHandle} from 'react' import { - Dimensions, - Keyboard, Pressable, StyleProp, + useWindowDimensions, View, ViewStyle, } from 'react-native' @@ -96,6 +95,7 @@ export function Outer({ const insets = useSafeAreaInsets() const closeCallbacks = React.useRef<(() => void)[]>([]) const {setDialogIsOpen} = useDialogStateControlContext() + const {height: windowHeight} = useWindowDimensions() /* * Used to manage open/closed, but index is otherwise handled internally by `BottomSheet` @@ -179,8 +179,7 @@ export function Outer({ // Android importantForAccessibility="yes" style={[a.absolute, a.inset_0]} - testID={testID} - onTouchMove={() => Keyboard.dismiss()}> + testID={testID}> @@ -243,11 +242,20 @@ export function Inner({children, style}: DialogInnerProps) { export const ScrollableInner = React.forwardRef< BottomSheetScrollViewMethods, DialogInnerProps ->(function ScrollableInner({children, style}, ref) { +>(function ScrollableInner( + { + children, + style, + keyboardShouldPersistTaps = 'handled', + keyboardDismissMode = 'on-drag', + }, + ref, +) { const insets = useSafeAreaInsets() return ( | DialogInnerPropsBase<{ label: string accessibilityLabelledBy?: undefined accessibilityDescribedBy?: undefined keyboardDismissMode?: ScrollViewProps['keyboardDismissMode'] + keyboardShouldPersistTaps?: ScrollViewProps['keyboardShouldPersistTaps'] }>