diff options
author | Minseo Lee <itoupluk427@gmail.com> | 2024-02-29 09:51:56 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-29 09:51:56 +0900 |
commit | a1127bfcfc7ad080a5bd6210c6561788f1643db8 (patch) | |
tree | f2280d0308e4fc979f59f4f7abe3ef31a86390a2 /src/components/Dialog/index.tsx | |
parent | b723c4ca7ce22f673ea60e119da8552c452741da (diff) | |
parent | 7fd13cacfea4e9e4609ac2cfa11749544fc2f8f8 (diff) | |
download | voidsky-a1127bfcfc7ad080a5bd6210c6561788f1643db8.tar.zst |
Merge branch 'main' into patch-3
Diffstat (limited to 'src/components/Dialog/index.tsx')
-rw-r--r-- | src/components/Dialog/index.tsx | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/components/Dialog/index.tsx b/src/components/Dialog/index.tsx index 27f43afd3..5c0350274 100644 --- a/src/components/Dialog/index.tsx +++ b/src/components/Dialog/index.tsx @@ -11,6 +11,7 @@ import {useSafeAreaInsets} from 'react-native-safe-area-context' import {useTheme, atoms as a, flatten} from '#/alf' import {Portal} from '#/components/Portal' import {createInput} from '#/components/forms/TextField' +import {logger} from '#/logger' import { DialogOuterProps, @@ -56,7 +57,7 @@ export function Outer({ ) const close = React.useCallback<DialogControlProps['close']>(cb => { - if (cb) { + if (cb && typeof cb === 'function') { closeCallback.current = cb } sheet.current?.close() @@ -74,8 +75,16 @@ export function Outer({ const onChange = React.useCallback( (index: number) => { if (index === -1) { - closeCallback.current?.() - closeCallback.current = undefined + try { + closeCallback.current?.() + } catch (e: any) { + logger.error(`Dialog closeCallback failed`, { + message: e.message, + }) + } finally { + closeCallback.current = undefined + } + onClose?.() setOpenIndex(-1) } |