diff --git a/ReactCommon/react/renderer/mounting/ShadowTree.cpp b/ReactCommon/react/renderer/mounting/ShadowTree.cpp index d4bb334261..cd077e8c56 100644 --- a/ReactCommon/react/renderer/mounting/ShadowTree.cpp +++ b/ReactCommon/react/renderer/mounting/ShadowTree.cpp @@ -222,22 +222,26 @@ ShadowTree::ShadowTree( SurfaceId surfaceId, LayoutConstraints const &layoutConstraints, LayoutContext const &layoutContext, - RootComponentDescriptor const &rootComponentDescriptor, ShadowTreeDelegate const &delegate, std::weak_ptr mountingOverrideDelegate) : surfaceId_(surfaceId), delegate_(delegate) { const auto noopEventEmitter = std::make_shared( nullptr, -1, std::shared_ptr()); + static auto globalRootComponentDescriptor = + std::make_unique( + ComponentDescriptorParameters{ + EventDispatcher::Shared{}, nullptr, nullptr}); + const auto props = std::make_shared( *RootShadowNode::defaultSharedProps(), layoutConstraints, layoutContext); auto const fragment = ShadowNodeFamilyFragment{surfaceId, surfaceId, noopEventEmitter}; - auto family = rootComponentDescriptor.createFamily(fragment, nullptr); + auto family = globalRootComponentDescriptor->createFamily(fragment, nullptr); auto rootShadowNode = std::static_pointer_cast( - rootComponentDescriptor.createShadowNode( + globalRootComponentDescriptor->createShadowNode( ShadowNodeFragment{ /* .props = */ props, }, diff --git a/ReactCommon/react/renderer/mounting/ShadowTree.h b/ReactCommon/react/renderer/mounting/ShadowTree.h index 1075ce6a8c..1bfd4b9339 100644 --- a/ReactCommon/react/renderer/mounting/ShadowTree.h +++ b/ReactCommon/react/renderer/mounting/ShadowTree.h @@ -67,7 +67,6 @@ class ShadowTree final { SurfaceId surfaceId, LayoutConstraints const &layoutConstraints, LayoutContext const &layoutContext, - RootComponentDescriptor const &rootComponentDescriptor, ShadowTreeDelegate const &delegate, std::weak_ptr mountingOverrideDelegate); diff --git a/ReactCommon/react/renderer/mounting/tests/StateReconciliationTest.cpp b/ReactCommon/react/renderer/mounting/tests/StateReconciliationTest.cpp index 292d4aa07c..92709cb243 100644 --- a/ReactCommon/react/renderer/mounting/tests/StateReconciliationTest.cpp +++ b/ReactCommon/react/renderer/mounting/tests/StateReconciliationTest.cpp @@ -10,7 +10,6 @@ #include #include -#include #include #include #include @@ -95,14 +94,10 @@ TEST(StateReconciliationTest, testStateReconciliation) { auto &family = shadowNodeAB->getFamily(); auto state1 = shadowNodeAB->getState(); auto shadowTreeDelegate = DummyShadowTreeDelegate{}; - auto eventDispatcher = EventDispatcher::Shared{}; - auto rootComponentDescriptor = - ComponentDescriptorParameters{eventDispatcher, nullptr, nullptr}; ShadowTree shadowTree{ SurfaceId{11}, LayoutConstraints{}, LayoutContext{}, - rootComponentDescriptor, shadowTreeDelegate, {}}; diff --git a/ReactCommon/react/renderer/scheduler/Scheduler.cpp b/ReactCommon/react/renderer/scheduler/Scheduler.cpp index e88a3f4414..ab9ea1f0f9 100644 --- a/ReactCommon/react/renderer/scheduler/Scheduler.cpp +++ b/ReactCommon/react/renderer/scheduler/Scheduler.cpp @@ -76,9 +76,6 @@ Scheduler::Scheduler( componentDescriptorRegistry_ = schedulerToolbox.componentRegistryFactory( eventDispatcher, schedulerToolbox.contextContainer); - rootComponentDescriptor_ = std::make_unique( - ComponentDescriptorParameters{eventDispatcher, nullptr, nullptr}); - uiManager->setBackgroundExecutor(schedulerToolbox.backgroundExecutor); uiManager->setDelegate(this); uiManager->setComponentDescriptorRegistry(componentDescriptorRegistry_); @@ -188,7 +185,6 @@ void Scheduler::startSurface( surfaceId, layoutConstraints, layoutContext, - *rootComponentDescriptor_, *uiManager_, mountingOverrideDelegate); diff --git a/ReactCommon/react/renderer/scheduler/Scheduler.h b/ReactCommon/react/renderer/scheduler/Scheduler.h index df86940fed..b213d640c0 100644 --- a/ReactCommon/react/renderer/scheduler/Scheduler.h +++ b/ReactCommon/react/renderer/scheduler/Scheduler.h @@ -123,7 +123,6 @@ class Scheduler final : public UIManagerDelegate { private: SchedulerDelegate *delegate_; SharedComponentDescriptorRegistry componentDescriptorRegistry_; - std::unique_ptr rootComponentDescriptor_; RuntimeExecutor runtimeExecutor_; std::shared_ptr uiManager_; std::shared_ptr reactNativeConfig_;