Skip to content

Commit

Permalink
default hitSlop values to 0 (#22281)
Browse files Browse the repository at this point in the history
Summary:
Experienced a `TouchableOpacity` releasing the `PanResponder` without invoking `onPress` due to a missing a direction key in the `hitSlop` prop; The missing key caused the corresponding pressExpand to become NaN which causes `isTouchWithinActive` to become falsey, when it should be truthy.

If defaulting to 0 is undesired behavior, I'm happy to take a different approach.
Pull Request resolved: #22281

Differential Revision: D13374335

Pulled By: cpojer

fbshipit-source-id: f9d28e51b9d9c45aed42bea2df3d844a799fa827
  • Loading branch information
Taylor123 authored and kelset committed Dec 12, 2018
1 parent f7e3def commit 274f5b8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Libraries/Components/Touchable/Touchable.js
Original file line number Diff line number Diff line change
Expand Up @@ -480,10 +480,10 @@ const TouchableMixin = {
: null;

if (hitSlop) {
pressExpandLeft += hitSlop.left;
pressExpandTop += hitSlop.top;
pressExpandRight += hitSlop.right;
pressExpandBottom += hitSlop.bottom;
pressExpandLeft += hitSlop.left || 0;
pressExpandTop += hitSlop.top || 0;
pressExpandRight += hitSlop.right || 0;
pressExpandBottom += hitSlop.bottom || 0;
}

const touch = TouchEventUtils.extractSingleTouch(e.nativeEvent);
Expand Down

0 comments on commit 274f5b8

Please sign in to comment.