diff options
author | Kuwa Lee <kuwalee1069@gmail.com> | 2024-06-15 19:00:34 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-15 19:00:34 +0800 |
commit | 01f505d09f35b642c5ea9206f10e1ff68f4eb0d5 (patch) | |
tree | 0489ad6af184fbe086a2376023f2cdaea358f8eb /src/components/Prompt.tsx | |
parent | b80594a554d91639eda70d311fcbc88c16c191a7 (diff) | |
parent | eaef1446f2236cc4c8993e4c57d5bcc5bb2263d9 (diff) | |
download | voidsky-01f505d09f35b642c5ea9206f10e1ff68f4eb0d5.tar.zst |
Merge branch 'bluesky-social:main' into zh
Diffstat (limited to 'src/components/Prompt.tsx')
-rw-r--r-- | src/components/Prompt.tsx | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/components/Prompt.tsx b/src/components/Prompt.tsx index d05cab5ab..315ad0dfd 100644 --- a/src/components/Prompt.tsx +++ b/src/components/Prompt.tsx @@ -1,10 +1,10 @@ import React from 'react' -import {View} from 'react-native' +import {GestureResponderEvent, View} from 'react-native' import {msg} from '@lingui/macro' import {useLingui} from '@lingui/react' import {atoms as a, useBreakpoints, useTheme} from '#/alf' -import {Button, ButtonColor, ButtonText} from '#/components/Button' +import {Button, ButtonColor, ButtonProps, ButtonText} from '#/components/Button' import * as Dialog from '#/components/Dialog' import {Text} from '#/components/Typography' @@ -136,7 +136,7 @@ export function Action({ * Note: The dialog will close automatically when the action is pressed, you * should NOT close the dialog as a side effect of this method. */ - onPress: () => void + onPress: ButtonProps['onPress'] color?: ButtonColor /** * Optional i18n string. If undefined, it will default to "Confirm". @@ -147,9 +147,12 @@ export function Action({ const {_} = useLingui() const {gtMobile} = useBreakpoints() const {close} = Dialog.useDialogContext() - const handleOnPress = React.useCallback(() => { - close(onPress) - }, [close, onPress]) + const handleOnPress = React.useCallback( + (e: GestureResponderEvent) => { + close(() => onPress?.(e)) + }, + [close, onPress], + ) return ( <Button @@ -186,7 +189,7 @@ export function Basic({ * Note: The dialog will close automatically when the action is pressed, you * should NOT close the dialog as a side effect of this method. */ - onConfirm: () => void + onConfirm: ButtonProps['onPress'] confirmButtonColor?: ButtonColor showCancel?: boolean }>) { |