From 45244ebce228dfbc3412670e64c11491ba8d8c47 Mon Sep 17 00:00:00 2001 From: Xin Chen Date: Wed, 26 Jan 2022 19:20:06 -0800 Subject: [PATCH] Fix TouchTargetHelper to correctly use the overflowInset information Summary: The overflowInset uses negative values to indicate extending from parent view. This diff fixes the math so that it's correctly check if the point is within overflowInset. Changelog [Android][Fixed] - Fix math for detecting if children views are in parent's overflowInset area. Reviewed By: genkikondo Differential Revision: D33750129 fbshipit-source-id: 1a5a33a227280c687b158b4a81a56017b6f4f3e0 --- .../java/com/facebook/react/uimanager/TouchTargetHelper.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 e2dbaf25150db5..bfac2387e2c970 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/TouchTargetHelper.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/TouchTargetHelper.java @@ -271,8 +271,8 @@ private static boolean isTouchPointInViewWithOverflowInset(float x, float y, Vie } final Rect overflowInset = ((ReactOverflowViewWithInset) view).getOverflowInset(); - return (x >= -overflowInset.left && x < view.getWidth() - overflowInset.right) - && (y >= -overflowInset.top && y < view.getHeight() - overflowInset.bottom); + return (x >= overflowInset.left && x < view.getWidth() - overflowInset.right) + && (y >= overflowInset.top && y < view.getHeight() - overflowInset.bottom); } /**