diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/Event.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/Event.java index 94515d47be1273..0b6a1140c8edab 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/Event.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/Event.java @@ -12,6 +12,7 @@ import com.facebook.react.common.SystemClock; import com.facebook.react.uimanager.IllegalViewOperationException; import com.facebook.react.uimanager.common.UIManagerType; +import com.facebook.react.uimanager.common.ViewUtil; /** * A UI event that can be dispatched to JS. @@ -80,7 +81,14 @@ protected void init(int surfaceId, int viewTag, long timestampMs) { // non-Fabric UIManager, and we cannot use the ViewTag for inference since it's not controlled // by RN and is essentially a random number. // At some point it would be great to pass the SurfaceContext here instead. - mUIManagerType = (surfaceId == -1 ? UIManagerType.DEFAULT : UIManagerType.FABRIC); + @UIManagerType + int uiManagerType = (surfaceId == -1 ? UIManagerType.DEFAULT : UIManagerType.FABRIC); + if (uiManagerType == UIManagerType.DEFAULT && !ViewUtil.isRootTag(viewTag)) { + // TODO (T123064648): Some events for Fabric still didn't have the surfaceId set, so if it's + // not a React RootView, double check if the tag belongs to Fabric. + uiManagerType = ViewUtil.getUIManagerType(viewTag); + } + mUIManagerType = uiManagerType; mTimestampMs = timestampMs; mInitialized = true;