diff options
Diffstat (limited to 'src/components')
-rw-r--r-- | src/components/Button.tsx | 1 | ||||
-rw-r--r-- | src/components/Dialog/index.tsx | 54 | ||||
-rw-r--r-- | src/components/forms/TextField.tsx | 6 | ||||
-rw-r--r-- | src/components/forms/ToggleButton.tsx | 2 |
4 files changed, 40 insertions, 23 deletions
diff --git a/src/components/Button.tsx b/src/components/Button.tsx index f88fbcbde..68cee4374 100644 --- a/src/components/Button.tsx +++ b/src/components/Button.tsx @@ -52,6 +52,7 @@ export type ButtonProps = React.PropsWithChildren< Pick<PressableProps, 'disabled' | 'onPress'> & AccessibilityProps & VariantProps & { + testID?: string label: string style?: StyleProp<ViewStyle> } diff --git a/src/components/Dialog/index.tsx b/src/components/Dialog/index.tsx index 44e4dc8a7..9132e68de 100644 --- a/src/components/Dialog/index.tsx +++ b/src/components/Dialog/index.tsx @@ -34,6 +34,7 @@ export function Outer({ const sheet = React.useRef<BottomSheet>(null) const sheetOptions = nativeOptions?.sheet || {} const hasSnapPoints = !!sheetOptions.snapPoints + const insets = useSafeAreaInsets() const open = React.useCallback<DialogControlProps['open']>((i = 0) => { sheet.current?.snapToIndex(i) @@ -41,8 +42,7 @@ export function Outer({ const close = React.useCallback(() => { sheet.current?.close() - onClose?.() - }, [onClose]) + }, []) useImperativeHandle( control.ref, @@ -53,6 +53,15 @@ export function Outer({ [open, close], ) + const onChange = React.useCallback( + (index: number) => { + if (index === -1) { + onClose?.() + } + }, + [onClose], + ) + const context = React.useMemo(() => ({close}), [close]) return ( @@ -63,6 +72,7 @@ export function Outer({ keyboardBehavior="interactive" android_keyboardInputMode="adjustResize" keyboardBlurBehavior="restore" + topInset={insets.top} {...sheetOptions} ref={sheet} index={-1} @@ -77,7 +87,7 @@ export function Outer({ )} handleIndicatorStyle={{backgroundColor: t.palette.primary_500}} handleStyle={{display: 'none'}} - onClose={onClose}> + onChange={onChange}> <Context.Provider value={context}> <View style={[ @@ -105,8 +115,8 @@ export function Inner(props: DialogInnerProps) { <BottomSheetView style={[ a.p_lg, - a.pt_3xl, { + paddingTop: 40, borderTopLeftRadius: 40, borderTopRightRadius: 40, paddingBottom: insets.bottom + a.pb_5xl.paddingBottom, @@ -121,11 +131,13 @@ export function ScrollableInner(props: DialogInnerProps) { const insets = useSafeAreaInsets() return ( <BottomSheetScrollView + keyboardShouldPersistTaps="handled" + keyboardDismissMode="on-drag" style={[ a.flex_1, // main diff is this - a.p_lg, - a.pt_3xl, + a.p_xl, { + paddingTop: 40, borderTopLeftRadius: 40, borderTopRightRadius: 40, }, @@ -139,21 +151,21 @@ export function ScrollableInner(props: DialogInnerProps) { export function Handle() { const t = useTheme() return ( - <View - style={[ - a.absolute, - a.rounded_sm, - a.z_10, - { - top: a.pt_lg.paddingTop, - width: 35, - height: 4, - alignSelf: 'center', - backgroundColor: t.palette.contrast_900, - opacity: 0.5, - }, - ]} - /> + <View style={[a.absolute, a.w_full, a.align_center, a.z_10, {height: 40}]}> + <View + style={[ + a.rounded_sm, + { + top: a.pt_lg.paddingTop, + width: 35, + height: 4, + alignSelf: 'center', + backgroundColor: t.palette.contrast_900, + opacity: 0.5, + }, + ]} + /> + </View> ) } diff --git a/src/components/forms/TextField.tsx b/src/components/forms/TextField.tsx index 70f900bb9..99d5e7152 100644 --- a/src/components/forms/TextField.tsx +++ b/src/components/forms/TextField.tsx @@ -238,10 +238,14 @@ export function createInput(Component: typeof TextInput) { export const Input = createInput(TextInput) -export function Label({children}: React.PropsWithChildren<{}>) { +export function Label({ + nativeID, + children, +}: React.PropsWithChildren<{nativeID?: string}>) { const t = useTheme() return ( <Text + nativeID={nativeID} style={[a.text_sm, a.font_bold, t.atoms.text_contrast_medium, a.mb_sm]}> {children} </Text> diff --git a/src/components/forms/ToggleButton.tsx b/src/components/forms/ToggleButton.tsx index 90790f9fc..7e1bd70b9 100644 --- a/src/components/forms/ToggleButton.tsx +++ b/src/components/forms/ToggleButton.tsx @@ -8,7 +8,7 @@ import * as Toggle from '#/components/forms/Toggle' export type ItemProps = Omit<Toggle.ItemProps, 'style' | 'role' | 'children'> & AccessibilityProps & - React.PropsWithChildren<{}> + React.PropsWithChildren<{testID?: string}> export type GroupProps = Omit<Toggle.GroupProps, 'style' | 'type'> & { multiple?: boolean |