From 4f38cb30b80dae3633328edd326eed1ba7db6a7d Mon Sep 17 00:00:00 2001 From: Joshua Gross Date: Thu, 15 Jul 2021 17:41:00 -0700 Subject: [PATCH] ][Fabric] Simplify init, always create new EventEmitter for Fabric Summary: Always create a new EventEmitter specifically for Fabric when initializing the Fabric JSI module. Previously, we were (sometimes!) reusing the EventEmitter being used for the old renderer and they were shared. There doesn't seem to be a compelling reason to continue doing this, and Fabric has optimized EventEmitters that we can use instead. Changelog: [Internal] Reviewed By: mdvacca Differential Revision: D29724537 fbshipit-source-id: 1b2c7a7d656e3fb86ddf98a6cf0f2e67dcbf8aef --- .../react/fabric/FabricJSIModuleProvider.java | 18 ++---------------- .../facebook/react/fabric/FabricUIManager.java | 1 + 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricJSIModuleProvider.java b/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricJSIModuleProvider.java index 8308b7be61d..d9ee45116cf 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricJSIModuleProvider.java +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricJSIModuleProvider.java @@ -7,10 +7,8 @@ package com.facebook.react.fabric; -import static com.facebook.react.config.ReactFeatureFlags.enableExperimentalStaticViewConfigs; import androidx.annotation.NonNull; -import com.facebook.infer.annotation.Assertions; import com.facebook.react.bridge.JSIModuleProvider; import com.facebook.react.bridge.ReactApplicationContext; import com.facebook.react.bridge.UIManager; @@ -18,9 +16,7 @@ import com.facebook.react.bridge.queue.MessageQueueThread; import com.facebook.react.common.mapbuffer.ReadableMapBufferSoLoader; import com.facebook.react.config.ReactFeatureFlags; import com.facebook.react.fabric.events.EventBeatManager; -import com.facebook.react.uimanager.UIManagerModule; import com.facebook.react.uimanager.ViewManagerRegistry; -import com.facebook.react.uimanager.events.EventDispatcher; import com.facebook.systrace.Systrace; public class FabricJSIModuleProvider implements JSIModuleProvider { @@ -77,18 +73,8 @@ public class FabricJSIModuleProvider implements JSIModuleProvider { Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, "FabricJSIModuleProvider.createUIManager"); FabricUIManager fabricUIManager; - if (enableExperimentalStaticViewConfigs) { - fabricUIManager = - new FabricUIManager(mReactApplicationContext, mViewManagerRegistry, eventBeatManager); - } else { - // TODO T83943316: Remove this code once StaticViewConfigs are enabled by default - UIManagerModule nativeModule = - Assertions.assertNotNull(mReactApplicationContext.getNativeModule(UIManagerModule.class)); - EventDispatcher eventDispatcher = nativeModule.getEventDispatcher(); - fabricUIManager = - new FabricUIManager( - mReactApplicationContext, mViewManagerRegistry, eventDispatcher, eventBeatManager); - } + fabricUIManager = + new FabricUIManager(mReactApplicationContext, mViewManagerRegistry, eventBeatManager); Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE); return fabricUIManager; } diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java b/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java index d5d3921b0e8..d4fbb1c177b 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java @@ -158,6 +158,7 @@ public class FabricUIManager implements UIManager, LifecycleEventListener { // TODO T83943316: Deprecate and delete this constructor once StaticViewConfigs are enabled by // default + @Deprecated public FabricUIManager( ReactApplicationContext reactContext, ViewManagerRegistry viewManagerRegistry,