Use negative hitSlop for gesture activation

This commit is contained in:
Brent Vatne 2018-09-25 14:34:11 -07:00
parent 7d18af1fb2
commit 6e9af03ee6
1 changed files with 12 additions and 1 deletions

View File

@ -71,7 +71,7 @@ const RESPOND_THRESHOLD = 20;
/**
* The distance of touch start from the edge of the screen where the gesture will be recognized
*/
const GESTURE_RESPONSE_DISTANCE_HORIZONTAL = 25;
const GESTURE_RESPONSE_DISTANCE_HORIZONTAL = 30;
const GESTURE_RESPONSE_DISTANCE_VERTICAL = 135;
const animatedSubscribeValue = animatedValue => {
@ -314,15 +314,26 @@ class StackViewLayout extends React.Component {
}
_gestureActivationCriteria = () => {
let { layout } = this.props.transitionProps;
if (this._isMotionVertical()) {
let height = layout.height.__getValue();
return {
maxDeltaX: 7,
minOffsetY: 15,
hitSlop: { bottom: -height + GESTURE_RESPONSE_DISTANCE_VERTICAL },
};
} else {
let width = layout.width.__getValue();
let hitSlop = -width + GESTURE_RESPONSE_DISTANCE_HORIZONTAL;
return {
minOffsetX: this._isMotionInverted() ? -15 : 15,
maxDeltaY: 5,
hitSlop: this._isMotionInverted()
? { left: hitSlop }
: { right: hitSlop },
};
}
};