mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-28 20:25:33 +08:00
default hitSlop values to 0 (#22281)
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: https://github.com/facebook/react-native/pull/22281 Differential Revision: D13374335 Pulled By: cpojer fbshipit-source-id: f9d28e51b9d9c45aed42bea2df3d844a799fa827
This commit is contained in:
committed by
Facebook Github Bot
parent
cbe7d41f3f
commit
f6d3a61677
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user