diff options
author | Hailey <me@haileyok.com> | 2024-02-29 15:27:00 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-29 15:27:00 -0800 |
commit | 04d4c9779f92812903ee2f76b28a9e8937fdbad3 (patch) | |
tree | a9537cd140f3ac0ce07910678d637b5c70d50619 /src | |
parent | 39d324ab8bd99ca0e19f3e8f4dea5a61d54e6bb4 (diff) | |
download | voidsky-04d4c9779f92812903ee2f76b28a9e8937fdbad3.tar.zst |
Dismiss keyboard when closing dialog (#3053)
Diffstat (limited to 'src')
-rw-r--r-- | src/components/Dialog/index.tsx | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/components/Dialog/index.tsx b/src/components/Dialog/index.tsx index 6dfc24f3b..b96d1f835 100644 --- a/src/components/Dialog/index.tsx +++ b/src/components/Dialog/index.tsx @@ -1,5 +1,5 @@ import React, {useImperativeHandle} from 'react' -import {View, Dimensions} from 'react-native' +import {View, Dimensions, Keyboard} from 'react-native' import BottomSheet, { BottomSheetBackdrop, BottomSheetScrollView, @@ -78,6 +78,7 @@ export function Outer({ const onChange = React.useCallback( (index: number) => { if (index === -1) { + Keyboard.dismiss() try { closeCallback.current?.() } catch (e: any) { @@ -190,8 +191,15 @@ export function ScrollableInner({children, style}: DialogInnerProps) { export function Handle() { const t = useTheme() + + const onTouchStart = React.useCallback(() => { + Keyboard.dismiss() + }, []) + return ( - <View style={[a.absolute, a.w_full, a.align_center, a.z_10, {height: 40}]}> + <View + style={[a.absolute, a.w_full, a.align_center, a.z_10, {height: 40}]} + onTouchStart={onTouchStart}> <View style={[ a.rounded_sm, |