refactor: pane gesture overlay animation

This commit is contained in:
Aman Harwara
2023-02-10 15:06:08 +05:30
parent 9fcaed4395
commit 7c84b77a62

View File

@@ -62,8 +62,20 @@ export const usePaneSwipeGesture = (
requestElementUpdate(0)
}
overlayElementRef.current?.remove()
overlayElementRef.current = null
if (overlayElementRef.current) {
overlayElementRef.current
.animate([{ opacity: 0 }], {
duration: 5,
fill: 'forwards',
})
.finished.then(() => {
if (overlayElementRef.current) {
overlayElementRef.current.remove()
overlayElementRef.current = null
}
})
.catch(console.error)
}
}
}