9e3f2f4374
* Extract BlockDrawerGeesture * Block drawer when scrolling interstitials
10 lines
498 B
TypeScript
10 lines
498 B
TypeScript
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>
|
|
}
|