Support RootView in UIManagerHelper.getSurfaceId

Summary:
The `Event.getSurfaceIdForView` method I added recently is actually a duplicate of `UIManagerHelper.getSurfaceId`, except that the latter doesn't support RootViews very well.

Changelog:
[Android][Changed] - Improved UIManagerHelper.getSurfaceId and removed Event.getSurfaceIdForView

Reviewed By: JoshuaGross, mdvacca

Differential Revision: D32102175

fbshipit-source-id: 01741df6b646037a4575e9ca302ea248af9fd6f3
This commit is contained in:
Pieter De Baets authored and Facebook GitHub Bot committed 2021-11-09 08:51:53 -08:00
1 parent 74b91c5073
commit 954fc04f58
3 files changed
+17 -31

No files matched your search

@@ -12,7 +12,6 @@ import android.view.ViewGroup;
import com.facebook.common.logging.FLog;
import com.facebook.infer.annotation.Assertions;
import com.facebook.react.common.ReactConstants;
import com.facebook.react.uimanager.events.Event;
import com.facebook.react.uimanager.events.EventDispatcher;
import com.facebook.react.uimanager.events.TouchEvent;
import com.facebook.react.uimanager.events.TouchEventCoalescingKeyHelper;
@@ -75,7 +74,7 @@ public class JSTouchDispatcher {
mTargetTag = findTargetTagAndSetCoordinates(ev);
eventDispatcher.dispatchEvent(
TouchEvent.obtain(
Event.getSurfaceIdForView(mRootViewGroup),
UIManagerHelper.getSurfaceId(mRootViewGroup),
mTargetTag,
TouchEventType.START,
ev,
@@ -100,7 +99,7 @@ public class JSTouchDispatcher {
findTargetTagAndSetCoordinates(ev);
eventDispatcher.dispatchEvent(
TouchEvent.obtain(
Event.getSurfaceIdForView(mRootViewGroup),
UIManagerHelper.getSurfaceId(mRootViewGroup),
mTargetTag,
TouchEventType.END,
ev,
@@ -115,7 +114,7 @@ public class JSTouchDispatcher {
findTargetTagAndSetCoordinates(ev);
eventDispatcher.dispatchEvent(
TouchEvent.obtain(
Event.getSurfaceIdForView(mRootViewGroup),
UIManagerHelper.getSurfaceId(mRootViewGroup),
mTargetTag,
TouchEventType.MOVE,
ev,
@@ -127,7 +126,7 @@ public class JSTouchDispatcher {
// New pointer goes down, this can only happen after ACTION_DOWN is sent for the first pointer
eventDispatcher.dispatchEvent(
TouchEvent.obtain(
Event.getSurfaceIdForView(mRootViewGroup),
UIManagerHelper.getSurfaceId(mRootViewGroup),
mTargetTag,
TouchEventType.START,
ev,
@@ -139,7 +138,7 @@ public class JSTouchDispatcher {
// Exactly one of the pointers goes up
eventDispatcher.dispatchEvent(
TouchEvent.obtain(
Event.getSurfaceIdForView(mRootViewGroup),
UIManagerHelper.getSurfaceId(mRootViewGroup),
mTargetTag,
TouchEventType.END,
ev,
@@ -188,7 +187,7 @@ public class JSTouchDispatcher {
Assertions.assertNotNull(eventDispatcher)
.dispatchEvent(
TouchEvent.obtain(
Event.getSurfaceIdForView(mRootViewGroup),
UIManagerHelper.getSurfaceId(mRootViewGroup),
mTargetTag,
TouchEventType.CANCEL,
androidEvent,