mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Fix non-touch event dispatching not being blocked by pointer-events
Summary: Changelog: [Android][Fixed] Scroll views would still receive scroll events when nested in a view with `pointer-events: "none"` Differential Revision: D36423921 fbshipit-source-id: 87b8a236e15dda7b648b6fc649187e95a9a2cc42
This commit is contained in:
committed by
Facebook GitHub Bot
parent
7b703eb78b
commit
fced96bf52
+10
@@ -559,6 +559,16 @@ public class ReactHorizontalScrollView extends HorizontalScrollView
|
||||
return super.onTouchEvent(ev);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean dispatchGenericPointerEvent(MotionEvent ev) {
|
||||
// We do not dispatch the pointer event if its children are not supposed to receive it
|
||||
if (!PointerEvents.canChildrenBeTouchTarget(mPointerEvents)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return super.dispatchGenericPointerEvent(ev);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean executeKeyEvent(KeyEvent event) {
|
||||
int eventKeyCode = event.getKeyCode();
|
||||
|
||||
@@ -397,6 +397,16 @@ public class ReactScrollView extends ScrollView
|
||||
return super.onTouchEvent(ev);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean dispatchGenericPointerEvent(MotionEvent ev) {
|
||||
// We do not dispatch the pointer event if its children are not supposed to receive it
|
||||
if (!PointerEvents.canChildrenBeTouchTarget(mPointerEvents)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return super.dispatchGenericPointerEvent(ev);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean executeKeyEvent(KeyEvent event) {
|
||||
int eventKeyCode = event.getKeyCode();
|
||||
|
||||
@@ -224,7 +224,7 @@ public class ReactViewGroup extends ViewGroup
|
||||
return true;
|
||||
}
|
||||
// We intercept the touch event if the children are not supposed to receive it.
|
||||
if (mPointerEvents == PointerEvents.NONE || mPointerEvents == PointerEvents.BOX_ONLY) {
|
||||
if (!PointerEvents.canChildrenBeTouchTarget(mPointerEvents)) {
|
||||
return true;
|
||||
}
|
||||
return super.onInterceptTouchEvent(ev);
|
||||
@@ -233,7 +233,7 @@ public class ReactViewGroup extends ViewGroup
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent ev) {
|
||||
// We do not accept the touch event if this view is not supposed to receive it.
|
||||
if (mPointerEvents == PointerEvents.NONE || mPointerEvents == PointerEvents.BOX_NONE) {
|
||||
if (!PointerEvents.canBeTouchTarget(mPointerEvents)) {
|
||||
return false;
|
||||
}
|
||||
// The root view always assumes any view that was tapped wants the touch
|
||||
@@ -244,6 +244,16 @@ public class ReactViewGroup extends ViewGroup
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean dispatchGenericPointerEvent(MotionEvent ev) {
|
||||
// We do not dispatch the pointer event if its children are not supposed to receive it
|
||||
if (!PointerEvents.canChildrenBeTouchTarget(mPointerEvents)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return super.dispatchGenericPointerEvent(ev);
|
||||
}
|
||||
|
||||
/**
|
||||
* We override this to allow developers to determine whether they need offscreen alpha compositing
|
||||
* or not. See the documentation of needsOffscreenAlphaCompositing in View.js.
|
||||
|
||||
Reference in New Issue
Block a user