From dc98ab0bb1c63c93e3a00c3f5b8a477aeb599c14 Mon Sep 17 00:00:00 2001 From: Genki Kondo Date: Wed, 22 Feb 2023 16:57:58 -0800 Subject: [PATCH] Fix EventAnimationDriverMatchSpec to match non-bubbling pointer events Summary: Changelog: [Android][Internal] - Fix EventAnimationDriverMatchSpec to match against the view that generated the event for non-bubbling pointer events. This should have no effect if you are not using PointerEvents Reviewed By: mdvacca Differential Revision: D43413771 fbshipit-source-id: 31ac751b3d3d55eb44d3a9ab54e5fb387dcaa9b3 --- .../react/uimanager/events/PointerEvent.java | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/PointerEvent.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/PointerEvent.java index 704859c8f273d1..589a115ba2a18d 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/PointerEvent.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/PointerEvent.java @@ -124,18 +124,21 @@ public Event.EventAnimationDriverMatchSpec getEventAnimationDriverMatchSpec() { new EventAnimationDriverMatchSpec() { @Override public boolean match(int viewTag, String eventName) { - if (!eventName.equals(mEventName) || !PointerEventHelper.isBubblingEvent(eventName)) { + if (!eventName.equals(mEventName)) { return false; } - List viewTargets = - mEventState.getHitPathForActivePointer(); - for (TouchTargetHelper.ViewTarget viewTarget : viewTargets) { - if (viewTarget.getViewId() == viewTag) { - return true; + if (PointerEventHelper.isBubblingEvent(eventName)) { + for (TouchTargetHelper.ViewTarget viewTarget : + mEventState.getHitPathForActivePointer()) { + if (viewTarget.getViewId() == viewTag) { + return true; + } } + return false; + } else { + return getViewTag() == viewTag; } - return false; } }; }