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 facebook-github-bot committed Dec 7, 2018
1 parent cbe7d41 commit f6d3a61
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 @@ -532,10 +532,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 = extractSingleTouch(e.nativeEvent);
Expand Down

0 comments on commit f6d3a61

Please sign in to comment.