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