@rnx-kit/react-native-host 0.5.7 → 0.5.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -53,12 +53,26 @@
|
|
|
53
53
|
@implementation RNXTurboModuleAdapter {
|
|
54
54
|
#if USE_FABRIC
|
|
55
55
|
RCTTurboModuleManager *_turboModuleManager;
|
|
56
|
+
std::weak_ptr<facebook::react::CallInvoker> _jsInvoker;
|
|
56
57
|
#endif // USE_FABRIC
|
|
57
58
|
#if USE_RUNTIME_SCHEDULER
|
|
58
59
|
std::shared_ptr<facebook::react::RuntimeScheduler> _runtimeScheduler;
|
|
59
60
|
#endif // USE_RUNTIME_SCHEDULER
|
|
60
61
|
}
|
|
61
62
|
|
|
63
|
+
#if USE_FABRIC
|
|
64
|
+
- (instancetype)init
|
|
65
|
+
{
|
|
66
|
+
if (self = [super init]) {
|
|
67
|
+
[NSNotificationCenter.defaultCenter addObserver:self
|
|
68
|
+
selector:@selector(onRuntimeReady:)
|
|
69
|
+
name:@"RCTInstanceDidLoadBundle"
|
|
70
|
+
object:nil];
|
|
71
|
+
}
|
|
72
|
+
return self;
|
|
73
|
+
}
|
|
74
|
+
#endif // USE_FABRIC
|
|
75
|
+
|
|
62
76
|
- (std::unique_ptr<facebook::react::JSExecutorFactory>)jsExecutorFactoryForBridge:
|
|
63
77
|
(RCTBridge *)bridge
|
|
64
78
|
{
|
|
@@ -90,6 +104,7 @@
|
|
|
90
104
|
jsInvoker:(std::shared_ptr<facebook::react::CallInvoker>)jsInvoker
|
|
91
105
|
{
|
|
92
106
|
#if __has_include(<react/nativemodule/defaults/DefaultTurboModules.h>) // >= 0.75
|
|
107
|
+
_jsInvoker = jsInvoker;
|
|
93
108
|
return facebook::react::DefaultTurboModules::getTurboModule(name, jsInvoker);
|
|
94
109
|
#else
|
|
95
110
|
return nullptr;
|
|
@@ -127,6 +142,18 @@
|
|
|
127
142
|
#endif // USE_RUNTIME_SCHEDULER
|
|
128
143
|
}
|
|
129
144
|
|
|
145
|
+
- (void)onRuntimeReady:(NSNotification *)note
|
|
146
|
+
{
|
|
147
|
+
if (auto jsInvoker = _jsInvoker.lock()) {
|
|
148
|
+
jsInvoker->invokeAsync([](facebook::jsi::Runtime &runtime) {
|
|
149
|
+
NSDictionary *userInfo = @{@"runtime": [NSValue valueWithPointer:&runtime]};
|
|
150
|
+
[NSNotificationCenter.defaultCenter postNotificationName:@"ReactAppRuntimeReady"
|
|
151
|
+
object:nil
|
|
152
|
+
userInfo:userInfo];
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
130
157
|
#endif // USE_FABRIC
|
|
131
158
|
|
|
132
159
|
@end
|
package/package.json
CHANGED