][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
This commit is contained in:
Joshua Gross
2021-07-15 17:42:13 -07:00
committed by Facebook GitHub Bot
parent 2b7366e41d
commit 4f38cb30b8
2 changed files with 3 additions and 16 deletions
@@ -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<UIManager> {
@@ -77,18 +73,8 @@ public class FabricJSIModuleProvider implements JSIModuleProvider<UIManager> {
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;
}
@@ -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,