react-native-raw-bottom-sheet
react-native-raw-bottom-sheet copied to clipboard
Add prop to allow dragging down from any touchable components inside the sheet
The new added prop closeOnTouchablesDragDown
is there to allow dragging down from gestures on any touchable components inside the bottom sheet. It doesn't affect any current behavior if disabled. And it doesn't affect any touchable components inside a scroll view.
When used the prop enables the pan responder function onMoveShouldSetPanResponder
and ignores "gestures" that only drags the touchable components less than 5px, and invokes normal touch on that component to allow some moving touches.
onMoveShouldSetPanResponder: (e, gestureState) => (
(closeOnTouchablesDragDown && closeOnDragDown)
&& (Math.abs(gestureState.dx) >= 5
|| Math.abs(gestureState.dy) >= 5)
)
I added that margin of error (5 px) because I found my self touching the component but my finger was moving slightly while touching so it was capturing it as a gesture.
Here is a demonstration of the feature and the old behavior