about summary refs log tree commit diff
path: root/src/view/shell/BlockDrawerGesture.tsx
blob: bae9a8db8282dc8d459972dc079fca853ee6c3e0 (plain) (blame)
1
2
3
4
5
6
7
8
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>
}