Skip to content

Commit

Permalink
Fix TouchTargetHelper to correctly use the overflowInset information
Browse files Browse the repository at this point in the history
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
  • Loading branch information
ryancat authored and facebook-github-bot committed Jan 27, 2022
1 parent 86fa2a5 commit 45244eb
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down

0 comments on commit 45244eb

Please sign in to comment.