Apply pointerEvents dispatch check in dispatchGenericMotionEvent (#43433)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43433

Changelog: [Android][Fixed] Views would still receive hover events when nested in a view with pointer-events: "none"

`View` calls `dispatchGenericPointerEvent` from `dispatchGenericMotionEvent` (https://android.googlesource.com/platform/frameworks/base/+/android-4.3_r2.1/core/java/android/view/View.java#7439), so this is the better method to override.

Reviewed By: markv

Differential Revision: D54799820

fbshipit-source-id: 896572b86a0e9053b0138a18ced938a9dc3e60fc
This commit is contained in:
Pieter De Baets
2024-03-13 04:43:12 -07:00
committed by Facebook GitHub Bot
parent 4f10f3069f
commit 38cbc082db
4 changed files with 12 additions and 12 deletions
@@ -6278,7 +6278,7 @@ public class com/facebook/react/views/scroll/ReactHorizontalScrollView : android
public fun addFocusables (Ljava/util/ArrayList;II)V
public fun arrowScroll (I)Z
public fun canScrollHorizontally (I)Z
public fun dispatchGenericPointerEvent (Landroid/view/MotionEvent;)Z
public fun dispatchGenericMotionEvent (Landroid/view/MotionEvent;)Z
public fun draw (Landroid/graphics/Canvas;)V
public fun executeKeyEvent (Landroid/view/KeyEvent;)Z
public fun flashScrollIndicators ()V
@@ -6404,7 +6404,7 @@ public class com/facebook/react/views/scroll/ReactScrollView : android/widget/Sc
public fun <init> (Landroid/content/Context;)V
public fun <init> (Landroid/content/Context;Lcom/facebook/react/views/scroll/FpsListener;)V
public fun abortAnimation ()V
public fun dispatchGenericPointerEvent (Landroid/view/MotionEvent;)Z
public fun dispatchGenericMotionEvent (Landroid/view/MotionEvent;)Z
public fun draw (Landroid/graphics/Canvas;)V
public fun executeKeyEvent (Landroid/view/KeyEvent;)Z
public fun flashScrollIndicators ()V
@@ -7567,7 +7567,7 @@ public class com/facebook/react/views/view/ReactViewGroup : android/view/ViewGro
public fun addView (Landroid/view/View;ILandroid/view/ViewGroup$LayoutParams;)V
protected fun addViewInLayout (Landroid/view/View;ILandroid/view/ViewGroup$LayoutParams;Z)Z
protected fun dispatchDraw (Landroid/graphics/Canvas;)V
public fun dispatchGenericPointerEvent (Landroid/view/MotionEvent;)Z
public fun dispatchGenericMotionEvent (Landroid/view/MotionEvent;)Z
public fun dispatchProvideStructure (Landroid/view/ViewStructure;)V
protected fun dispatchSetPressed (Z)V
protected fun drawChild (Landroid/graphics/Canvas;Landroid/view/View;J)Z
@@ -640,13 +640,13 @@ public class ReactHorizontalScrollView extends HorizontalScrollView
}
@Override
public boolean dispatchGenericPointerEvent(MotionEvent ev) {
// We do not dispatch the pointer event if its children are not supposed to receive it
public boolean dispatchGenericMotionEvent(MotionEvent ev) {
// We do not dispatch the motion event if its children are not supposed to receive it
if (!PointerEvents.canChildrenBeTouchTarget(mPointerEvents)) {
return false;
}
return super.dispatchGenericPointerEvent(ev);
return super.dispatchGenericMotionEvent(ev);
}
@Override
@@ -463,13 +463,13 @@ public class ReactScrollView extends ScrollView
}
@Override
public boolean dispatchGenericPointerEvent(MotionEvent ev) {
// We do not dispatch the pointer event if its children are not supposed to receive it
public boolean dispatchGenericMotionEvent(MotionEvent ev) {
// We do not dispatch the motion event if its children are not supposed to receive it
if (!PointerEvents.canChildrenBeTouchTarget(mPointerEvents)) {
return false;
}
return super.dispatchGenericPointerEvent(ev);
return super.dispatchGenericMotionEvent(ev);
}
@Override
@@ -284,13 +284,13 @@ public class ReactViewGroup extends ViewGroup
}
@Override
public boolean dispatchGenericPointerEvent(MotionEvent ev) {
// We do not dispatch the pointer event if its children are not supposed to receive it
public boolean dispatchGenericMotionEvent(MotionEvent ev) {
// We do not dispatch the motion event if its children are not supposed to receive it
if (!PointerEvents.canChildrenBeTouchTarget(mPointerEvents)) {
return false;
}
return super.dispatchGenericPointerEvent(ev);
return super.dispatchGenericMotionEvent(ev);
}
/**