about summary refs log tree commit diff
path: root/src/view/shell/BlockDrawerGesture.tsx
diff options
context:
space:
mode:
authordan <dan.abramov@gmail.com>2025-01-17 01:17:13 +0000
committerGitHub <noreply@github.com>2025-01-17 01:17:13 +0000
commit9e3f2f43745eed9c71cb985e48135b7363d91aa9 (patch)
tree4c6a8579598131182ecf28907b2f5ef82fb89de4 /src/view/shell/BlockDrawerGesture.tsx
parent39ed104935254fd30709d319a341d5c4b2bec0d2 (diff)
downloadvoidsky-9e3f2f43745eed9c71cb985e48135b7363d91aa9.tar.zst
Prevent Drawer gesture conflicting with Suggestions scroll (#7468)
* Extract BlockDrawerGeesture

* Block drawer when scrolling interstitials
Diffstat (limited to 'src/view/shell/BlockDrawerGesture.tsx')
-rw-r--r--src/view/shell/BlockDrawerGesture.tsx9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/view/shell/BlockDrawerGesture.tsx b/src/view/shell/BlockDrawerGesture.tsx
new file mode 100644
index 000000000..bae9a8db8
--- /dev/null
+++ b/src/view/shell/BlockDrawerGesture.tsx
@@ -0,0 +1,9 @@
+import {useContext} from 'react'
+import {DrawerGestureContext} from 'react-native-drawer-layout'
+import {Gesture, GestureDetector} from 'react-native-gesture-handler'
+
+export function BlockDrawerGesture({children}: {children: React.ReactNode}) {
+  const drawerGesture = useContext(DrawerGestureContext) ?? Gesture.Native() // noop for web
+  const scrollGesture = Gesture.Native().blocksExternalGesture(drawerGesture)
+  return <GestureDetector gesture={scrollGesture}>{children}</GestureDetector>
+}