mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-05-12 18:08:21 +08:00
Make GESTURE_RESPONSE_DISTANCE_* configurable. (#2172)
* Make gestureResponseDistance configurable. * Fix format. * Set vertical and horizontal distance individually. * Fix type error. * Move gestureResponseDistance to NavigationStackScreenOptions. * Add documentation.
This commit is contained in:
committed by
Lorenzo Sciandra
parent
b759d3136e
commit
69397af74d
@@ -272,9 +272,14 @@ class CardStack extends Component {
|
||||
// Measure the distance from the touch to the edge of the screen
|
||||
const screenEdgeDistance = currentDragPosition - currentDragDistance;
|
||||
// Compare to the gesture distance relavant to card or modal
|
||||
const {
|
||||
gestureResponseDistance: userGestureResponseDistance = {},
|
||||
} = this._getScreenDetails(scene).options;
|
||||
const gestureResponseDistance = isVertical
|
||||
? GESTURE_RESPONSE_DISTANCE_VERTICAL
|
||||
: GESTURE_RESPONSE_DISTANCE_HORIZONTAL;
|
||||
? userGestureResponseDistance.vertical ||
|
||||
GESTURE_RESPONSE_DISTANCE_VERTICAL
|
||||
: userGestureResponseDistance.horizontal ||
|
||||
GESTURE_RESPONSE_DISTANCE_HORIZONTAL;
|
||||
// GESTURE_RESPONSE_DISTANCE is about 25 or 30. Or 135 for modals
|
||||
if (screenEdgeDistance > gestureResponseDistance) {
|
||||
// Reject touches that started in the middle of the screen
|
||||
|
||||
Reference in New Issue
Block a user