chore: correctly close modals and show toast after creating note from shared text

This commit is contained in:
Aman Harwara
2023-07-13 02:16:54 +05:30
parent 8294d0663f
commit 512b8d9fbc
7 changed files with 50 additions and 9 deletions

View File

@@ -6,6 +6,7 @@ import MobileModalAction from '../Modal/MobileModalAction'
import { useModalAnimation } from '../Modal/useModalAnimation'
import MobileModalHeader from '../Modal/MobileModalHeader'
import { mergeRefs } from '@/Hooks/mergeRefs'
import { DialogWithClose } from '@/Utils/CloseOpenModalsAndPopovers'
const DisableScroll = () => {
useDisableBodyScrollOnMobile()
@@ -13,8 +14,6 @@ const DisableScroll = () => {
return null
}
type PopoverWithClose = HTMLDivElement & { close: () => void }
const MobilePopoverContent = ({
open,
requestClose,
@@ -35,7 +34,7 @@ const MobilePopoverContent = ({
const addCloseMethod = useCallback(
(element: HTMLDivElement | null) => {
if (element) {
;(element as PopoverWithClose).close = requestClose
;(element as DialogWithClose).close = requestClose
}
},
[requestClose],