From ec31b38ef199660db6bc720683b4554c02d27ebb Mon Sep 17 00:00:00 2001 From: Pieter De Baets Date: Fri, 15 Oct 2021 04:33:29 -0700 Subject: [PATCH] Fix bug with hittesting when skipping views due to overflow Summary: Noticed we were sometimes receiving incorrect paths through the view hierarchy. This was largely harmless, as the hover events generated from this would still be correct. We just sometimes send more onExit/onEnter events than necessary. Changelog: [Internal] Reviewed By: rshest Differential Revision: D31434300 fbshipit-source-id: 3888270eaa16edf48f5d894a1e6daeca1ecfed1e --- .../java/com/facebook/react/uimanager/TouchTargetHelper.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/TouchTargetHelper.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/TouchTargetHelper.java index 4436ceda2b3..05d2b48971b 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/TouchTargetHelper.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/TouchTargetHelper.java @@ -182,7 +182,6 @@ public class TouchTargetHelper { eventCoords[0] = childPoint.x; eventCoords[1] = childPoint.y; View targetView = findTouchTargetViewWithPointerEvents(eventCoords, child, pathAccumulator); - if (targetView != null) { // We don't allow touches on views that are outside the bounds of an `overflow: hidden` // View @@ -196,6 +195,9 @@ public class TouchTargetHelper { } if (inOverflowBounds) { return targetView; + } else if (pathAccumulator != null) { + // Not a hit, reset the path found so far + pathAccumulator.clear(); } } eventCoords[0] = restoreX;