stop auto hiding keyboard, allow scrollview props to handle

This commit is contained in:
Samuel Newman
2024-09-30 15:15:13 +03:00
parent 91d6753d4f
commit b9452ba15a
2 changed files with 17 additions and 7 deletions
+15 -7
View File
@@ -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}>
<BottomSheet
enableDynamicSizing={!hasSnapPoints}
enablePanDownToClose
@@ -206,7 +205,7 @@ export function Outer({
{
borderTopLeftRadius: 40,
borderTopRightRadius: 40,
height: Dimensions.get('window').height * 2,
height: windowHeight * 2,
},
]}
/>
@@ -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 (
<BottomSheetScrollView
keyboardShouldPersistTaps="handled"
keyboardShouldPersistTaps={keyboardShouldPersistTaps}
keyboardDismissMode={keyboardDismissMode}
style={[
a.flex_1, // main diff is this
a.p_xl,
+2
View File
@@ -66,10 +66,12 @@ export type DialogInnerProps =
accessibilityLabelledBy: A11yProps['aria-labelledby']
accessibilityDescribedBy: string
keyboardDismissMode?: ScrollViewProps['keyboardDismissMode']
keyboardShouldPersistTaps?: ScrollViewProps['keyboardShouldPersistTaps']
}>
| DialogInnerPropsBase<{
label: string
accessibilityLabelledBy?: undefined
accessibilityDescribedBy?: undefined
keyboardDismissMode?: ScrollViewProps['keyboardDismissMode']
keyboardShouldPersistTaps?: ScrollViewProps['keyboardShouldPersistTaps']
}>