about summary refs log tree commit diff
path: root/src/view/shell/BlockDrawerGesture.tsx
diff options
context:
space:
mode:
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>
+}