File tree Expand file tree Collapse file tree 3 files changed +54
-0
lines changed
ReactAndroid/src/main/jni/react/turbomodule/ReactCommon
ReactCommon/react/nativemodule/core/ReactCommon Expand file tree Collapse file tree 3 files changed +54
-0
lines changed Original file line number Diff line number Diff line change 20
20
#include < ReactCommon/TurboCxxModule.h>
21
21
#include < ReactCommon/TurboModuleBinding.h>
22
22
#include < ReactCommon/TurboModulePerfLogger.h>
23
+ #include < ReactCommon/TurboModuleWithJSIBindings.h>
23
24
#include < react/jni/CxxModuleWrapper.h>
24
25
25
26
namespace facebook ::react {
@@ -165,6 +166,7 @@ std::shared_ptr<TurboModule> TurboModuleManager::getTurboModule(
165
166
166
167
auto cxxModule = cxxDelegate->getTurboModule (name, jsCallInvoker_);
167
168
if (cxxModule) {
169
+ TurboModuleWithJSIBindings::installJSIBindings (cxxModule, runtime);
168
170
turboModuleCache_.insert ({name, cxxModule});
169
171
return cxxModule;
170
172
}
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ #include " TurboModuleWithJSIBindings.h"
9
+
10
+ #include < ReactCommon/TurboModule.h>
11
+
12
+ namespace facebook ::react {
13
+
14
+ /* static */ void TurboModuleWithJSIBindings::installJSIBindings (
15
+ const std::shared_ptr<TurboModule>& cxxModule,
16
+ jsi::Runtime& runtime) {
17
+ if (auto * cxxModuleWithJSIBindings =
18
+ dynamic_cast <TurboModuleWithJSIBindings*>(cxxModule.get ())) {
19
+ cxxModuleWithJSIBindings->installJSIBindingsWithRuntime (runtime);
20
+ }
21
+ }
22
+
23
+ } // namespace facebook::react
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ #pragma once
9
+
10
+ #include < ReactCommon/CallInvoker.h>
11
+ #include < jsi/jsi.h>
12
+
13
+ namespace facebook ::react {
14
+
15
+ class TurboModule ;
16
+
17
+ class TurboModuleWithJSIBindings {
18
+ public:
19
+ virtual ~TurboModuleWithJSIBindings () = default ;
20
+
21
+ static void installJSIBindings (
22
+ const std::shared_ptr<TurboModule>& cxxModule,
23
+ jsi::Runtime& runtime);
24
+
25
+ private:
26
+ virtual void installJSIBindingsWithRuntime (jsi::Runtime& runtime) = 0;
27
+ };
28
+
29
+ } // namespace facebook::react
You can’t perform that action at this time.
0 commit comments