use `onClose` instead of `onChange` for close callback (#3116)
parent
20b88f43e2
commit
57854e6fc2
|
@ -119,27 +119,21 @@ export function Outer({
|
||||||
[open, close],
|
[open, close],
|
||||||
)
|
)
|
||||||
|
|
||||||
const onChange = React.useCallback(
|
const onCloseInner = React.useCallback(() => {
|
||||||
(index: number) => {
|
Keyboard.dismiss()
|
||||||
if (index === -1) {
|
try {
|
||||||
Keyboard.dismiss()
|
closeCallback.current?.()
|
||||||
try {
|
} catch (e: any) {
|
||||||
closeCallback.current?.()
|
logger.error(`Dialog closeCallback failed`, {
|
||||||
} catch (e: any) {
|
message: e.message,
|
||||||
logger.error(`Dialog closeCallback failed`, {
|
})
|
||||||
message: e.message,
|
} finally {
|
||||||
})
|
closeCallback.current = undefined
|
||||||
} finally {
|
}
|
||||||
closeCallback.current = undefined
|
setDialogIsOpen(control.id, false)
|
||||||
}
|
onClose?.()
|
||||||
|
setOpenIndex(-1)
|
||||||
setDialogIsOpen(control.id, false)
|
}, [control.id, onClose, setDialogIsOpen])
|
||||||
onClose?.()
|
|
||||||
setOpenIndex(-1)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
[onClose, setOpenIndex, setDialogIsOpen, control.id],
|
|
||||||
)
|
|
||||||
|
|
||||||
const context = React.useMemo(() => ({close}), [close])
|
const context = React.useMemo(() => ({close}), [close])
|
||||||
|
|
||||||
|
@ -167,7 +161,7 @@ export function Outer({
|
||||||
backdropComponent={Backdrop}
|
backdropComponent={Backdrop}
|
||||||
handleIndicatorStyle={{backgroundColor: t.palette.primary_500}}
|
handleIndicatorStyle={{backgroundColor: t.palette.primary_500}}
|
||||||
handleStyle={{display: 'none'}}
|
handleStyle={{display: 'none'}}
|
||||||
onChange={onChange}>
|
onClose={onCloseInner}>
|
||||||
<Context.Provider value={context}>
|
<Context.Provider value={context}>
|
||||||
<View
|
<View
|
||||||
style={[
|
style={[
|
||||||
|
|
Loading…
Reference in New Issue