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:
Masayuki Iwai
2017-09-26 04:16:13 +09:00
committed by Lorenzo Sciandra
parent b759d3136e
commit 69397af74d
3 changed files with 15 additions and 2 deletions

View File

@@ -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