@@ -58,27 +58,23 @@ static bool checkGetCallableModuleIsActive(jsi::Runtime &runtime) {
5858 return true ;
5959}
6060
61- std::shared_ptr<UIManagerBinding> UIManagerBinding::createAndInstallIfNeeded (
61+ void UIManagerBinding::createAndInstallIfNeeded (
6262 jsi::Runtime &runtime,
63- RuntimeExecutor const &runtimeExecutor) {
63+ RuntimeExecutor const &runtimeExecutor,
64+ std::shared_ptr<UIManager> const &uiManager) {
6465 auto uiManagerModuleName = " nativeFabricUIManager" ;
6566
6667 auto uiManagerValue =
6768 runtime.global ().getProperty (runtime, uiManagerModuleName);
6869 if (uiManagerValue.isUndefined ()) {
6970 // The global namespace does not have an instance of the binding;
7071 // we need to create, install and return it.
71- auto uiManagerBinding = std::make_shared<UIManagerBinding>(runtimeExecutor);
72+ auto uiManagerBinding =
73+ std::make_shared<UIManagerBinding>(uiManager, runtimeExecutor);
7274 auto object = jsi::Object::createFromHostObject (runtime, uiManagerBinding);
7375 runtime.global ().setProperty (
7476 runtime, uiManagerModuleName, std::move (object));
75- return uiManagerBinding;
7677 }
77-
78- // The global namespace already has an instance of the binding;
79- // we need to return that.
80- auto uiManagerObject = uiManagerValue.asObject (runtime);
81- return uiManagerObject.getHostObject <UIManagerBinding>(runtime);
8278}
8379
8480std::shared_ptr<UIManagerBinding> UIManagerBinding::getBinding (
@@ -95,18 +91,16 @@ std::shared_ptr<UIManagerBinding> UIManagerBinding::getBinding(
9591 return uiManagerObject.getHostObject <UIManagerBinding>(runtime);
9692}
9793
98- UIManagerBinding::UIManagerBinding (RuntimeExecutor const &runtimeExecutor)
99- : runtimeExecutor_(runtimeExecutor) {}
94+ UIManagerBinding::UIManagerBinding (
95+ std::shared_ptr<UIManager> const &uiManager,
96+ RuntimeExecutor const &runtimeExecutor)
97+ : uiManager_(uiManager), runtimeExecutor_(runtimeExecutor) {}
10098
10199UIManagerBinding::~UIManagerBinding () {
102100 LOG (WARNING) << " UIManagerBinding::~UIManagerBinding() was called (address: "
103101 << this << " )." ;
104102}
105103
106- void UIManagerBinding::attach (std::shared_ptr<UIManager> const &uiManager) {
107- uiManager_ = uiManager;
108- }
109-
110104static jsi::Value callMethodOfModule (
111105 jsi::Runtime &runtime,
112106 std::string const &moduleName,
0 commit comments