Skip to content

Commit 21ff5b0

Browse files
committed
Moved setting CallInvoker to turbo module constructor
1 parent 412db53 commit 21ff5b0

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

packages/host/android/src/main/cpp/OnLoad.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#include <ReactCommon/CxxTurboModuleUtils.h>
44

55
#include <CxxNodeApiHostModule.hpp>
6-
#include <RuntimeNodeApiAsync.hpp>
76
#include <WeakNodeApiInjector.hpp>
87

98
// Called when the library is loaded
@@ -13,7 +12,6 @@ jint JNI_OnLoad(JavaVM *vm, void *reserved) {
1312
facebook::react::registerCxxModuleToGlobalModuleMap(
1413
callstack::nodeapihost::CxxNodeApiHostModule::kModuleName,
1514
[](std::shared_ptr<facebook::react::CallInvoker> jsInvoker) {
16-
callstack::nodeapihost::setCallInvoker(jsInvoker);
1715
return std::make_shared<callstack::nodeapihost::CxxNodeApiHostModule>(
1816
jsInvoker);
1917
});

packages/host/cpp/CxxNodeApiHostModule.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include "CxxNodeApiHostModule.hpp"
22
#include "Logger.hpp"
3+
#include "RuntimeNodeApiAsync.hpp"
34

45
using namespace facebook;
56

@@ -10,6 +11,8 @@ CxxNodeApiHostModule::CxxNodeApiHostModule(
1011
: TurboModule(CxxNodeApiHostModule::kModuleName, jsInvoker) {
1112
methodMap_["requireNodeAddon"] =
1213
MethodMetadata{1, &CxxNodeApiHostModule::requireNodeAddon};
14+
15+
callstack::nodeapihost::setCallInvoker(jsInvoker);
1316
}
1417

1518
jsi::Value

packages/host/ios/NodeApiHostModuleProvider.mm

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#import "CxxNodeApiHostModule.hpp"
22
#import "WeakNodeApiInjector.hpp"
3-
#import "RuntimeNodeApiAsync.hpp"
43

54
#define USE_CXX_TURBO_MODULE_UTILS 0
65
#if defined(__has_include)
@@ -28,7 +27,6 @@ + (void)load {
2827
facebook::react::registerCxxModuleToGlobalModuleMap(
2928
callstack::nodeapihost::CxxNodeApiHostModule::kModuleName,
3029
[](std::shared_ptr<facebook::react::CallInvoker> jsInvoker) {
31-
callstack::nodeapihost::setCallInvoker(jsInvoker);
3230
return std::make_shared<callstack::nodeapihost::CxxNodeApiHostModule>(
3331
jsInvoker);
3432
});

0 commit comments

Comments
 (0)