mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Do not register touch target for out of bounds events with clipChildren set to true
Summary: Similar to the previous diff, we should not allow view group that has clipChildren set to true to respond events that are out of bounds. Changelog: [Internal][Android] Reviewed By: ShikaSD Differential Revision: D33102331 fbshipit-source-id: de3a5ffdd5293ada1d2c211659e79edc697b5d15
This commit is contained in:
committed by
Facebook GitHub Bot
parent
0bd09c046a
commit
51fe19084f
@@ -178,17 +178,24 @@ public class TouchTargetHelper {
|
||||
// We prefer returning a child, so we check for a child that can handle the touch first
|
||||
if (allowReturnTouchTargetTypes.contains(TouchTargetReturnType.CHILD)
|
||||
&& view instanceof ViewGroup) {
|
||||
// We don't allow touches on views that are outside the bounds of an `overflow: hidden` and
|
||||
// `overflow: scroll` View.
|
||||
if (view instanceof ReactOverflowView) {
|
||||
@Nullable String overflow = ((ReactOverflowView) view).getOverflow();
|
||||
if ((ViewProps.HIDDEN.equals(overflow) || ViewProps.SCROLL.equals(overflow))
|
||||
&& !isTouchPointInView(eventCoords[0], eventCoords[1], view)) {
|
||||
ViewGroup viewGroup = (ViewGroup) view;
|
||||
if (!isTouchPointInView(eventCoords[0], eventCoords[1], view)) {
|
||||
// We don't allow touches on views that are outside the bounds of an `overflow: hidden` and
|
||||
// `overflow: scroll` View.
|
||||
if (view instanceof ReactOverflowView) {
|
||||
@Nullable String overflow = ((ReactOverflowView) view).getOverflow();
|
||||
if (ViewProps.HIDDEN.equals(overflow) || ViewProps.SCROLL.equals(overflow)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// We don't allow touches on views that are outside the bounds and has clipChildren set to
|
||||
// true.
|
||||
if (viewGroup.getClipChildren()) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
ViewGroup viewGroup = (ViewGroup) view;
|
||||
int childrenCount = viewGroup.getChildCount();
|
||||
// Consider z-index when determining the touch target.
|
||||
ReactZIndexedViewGroup zIndexedViewGroup =
|
||||
|
||||
Reference in New Issue
Block a user