From 7c84b77a6226d8e98c484fdd5da7b0fd1631340d Mon Sep 17 00:00:00 2001 From: Aman Harwara Date: Fri, 10 Feb 2023 15:06:08 +0530 Subject: [PATCH] refactor: pane gesture overlay animation --- .../Components/Panes/usePaneGesture.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/packages/web/src/javascripts/Components/Panes/usePaneGesture.ts b/packages/web/src/javascripts/Components/Panes/usePaneGesture.ts index d3767f27d..20526a0f7 100644 --- a/packages/web/src/javascripts/Components/Panes/usePaneGesture.ts +++ b/packages/web/src/javascripts/Components/Panes/usePaneGesture.ts @@ -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) + } } }