Improve reliability of modal close
This commit is contained in:
@@ -21,13 +21,14 @@ export const Modal = observer(function Modal() {
|
|||||||
const store = useStores()
|
const store = useStores()
|
||||||
const bottomSheetRef = useRef<BottomSheet>(null)
|
const bottomSheetRef = useRef<BottomSheet>(null)
|
||||||
|
|
||||||
const onShareBottomSheetChange = (snapPoint: number) => {
|
const onBottomSheetChange = (snapPoint: number) => {
|
||||||
if (snapPoint === -1) {
|
if (snapPoint === -1) {
|
||||||
store.shell.closeModal()
|
store.shell.closeModal()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const onClose = () => {
|
const onClose = () => {
|
||||||
bottomSheetRef.current?.close()
|
bottomSheetRef.current?.close()
|
||||||
|
store.shell.closeModal()
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -99,7 +100,7 @@ export const Modal = observer(function Modal() {
|
|||||||
backdropComponent={
|
backdropComponent={
|
||||||
store.shell.isModalActive ? createCustomBackdrop(onClose) : undefined
|
store.shell.isModalActive ? createCustomBackdrop(onClose) : undefined
|
||||||
}
|
}
|
||||||
onChange={onShareBottomSheetChange}>
|
onChange={onBottomSheetChange}>
|
||||||
{element}
|
{element}
|
||||||
</BottomSheet>
|
</BottomSheet>
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user