From 6d45e49dc783d0af3a39be2df5e8495541d65e5f Mon Sep 17 00:00:00 2001 From: Lulu Wu Date: Thu, 2 Feb 2023 05:35:47 -0800 Subject: [PATCH] Align creation of FabricUIManager with bridge Summary: - Bridgeless is using a deprecated FabricUIManager constructor which bridge doesn't use, and is the only one using it, this diff migrated bridgeless to use the same FabricUIManager constructor as bridge - Remove static view config check (mShouldDeallocateEventDispatcher), instead use Bridgeless check since SVC is enabled in Bridgeless but not in Bridge. Changelog: [Android][Changed] - Align creation of FabricUIManager with bridge Reviewed By: javache Differential Revision: D42681489 fbshipit-source-id: b9c7c4a81a98db52e881138cc85be0e85df636d9 --- .../react/fabric/FabricUIManager.java | 33 +++---------------- 1 file changed, 4 insertions(+), 29 deletions(-) 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 e0947264fd959a..5f3a34038bed36 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java @@ -182,9 +182,6 @@ public void onFabricCommitEnd(DevToolsReactPerfLogger.FabricCommitPoint commitPo */ private volatile boolean mDestroyed = false; - // TODO T83943316: Delete this variable once StaticViewConfigs are enabled by default - private volatile boolean mShouldDeallocateEventDispatcher = false; - private boolean mDriveCxxAnimations = false; private long mDispatchViewUpdatesTime = 0l; @@ -209,28 +206,6 @@ public void executeItems(Queue items) { } }; - // TODO T83943316: Deprecate and delete this constructor once StaticViewConfigs are enabled by - // default - @Deprecated - public FabricUIManager( - ReactApplicationContext reactContext, - ViewManagerRegistry viewManagerRegistry, - EventDispatcher eventDispatcher, - EventBeatManager eventBeatManager) { - mDispatchUIFrameCallback = new DispatchUIFrameCallback(reactContext); - mReactApplicationContext = reactContext; - mMountingManager = new MountingManager(viewManagerRegistry, mMountItemExecutor); - mMountItemDispatcher = - new MountItemDispatcher(mMountingManager, new MountItemDispatchListener()); - mEventDispatcher = eventDispatcher; - mShouldDeallocateEventDispatcher = false; - mEventBeatManager = eventBeatManager; - mReactApplicationContext.addLifecycleEventListener(this); - - mViewManagerRegistry = viewManagerRegistry; - mReactApplicationContext.registerComponentCallbacks(viewManagerRegistry); - } - public FabricUIManager( ReactApplicationContext reactContext, ViewManagerRegistry viewManagerRegistry, @@ -241,7 +216,6 @@ public FabricUIManager( mMountItemDispatcher = new MountItemDispatcher(mMountingManager, new MountItemDispatchListener()); mEventDispatcher = new EventDispatcherImpl(reactContext); - mShouldDeallocateEventDispatcher = true; mEventBeatManager = eventBeatManager; mReactApplicationContext.addLifecycleEventListener(this); @@ -467,10 +441,11 @@ public void onCatalystInstanceDestroy() { ViewManagerPropertyUpdater.clear(); - // When using StaticViewConfigs is enabled, FabriUIManager is - // responsible for initializing and deallocating EventDispatcher. + // When StaticViewConfigs is enabled, FabriUIManager is + // responsible for initializing and deallocating EventDispatcher. StaticViewConfigs is enabled + // only in Bridgeless for now. // TODO T83943316: Remove this IF once StaticViewConfigs are enabled by default - if (mShouldDeallocateEventDispatcher) { + if (!ReactFeatureFlags.enableBridgelessArchitecture) { mEventDispatcher.onCatalystInstanceDestroyed(); } }