@rnx-kit/react-native-host 0.4.6 → 0.4.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.
|
@@ -23,6 +23,21 @@ using SharedJSRuntimeFactory = std::shared_ptr<facebook::react::JSRuntimeFactory
|
|
|
23
23
|
@interface RCTHost (Compatibility)
|
|
24
24
|
@property (nonatomic, readonly) RCTModuleRegistry *moduleRegistry; // Introduced in 0.74
|
|
25
25
|
@property (nonatomic, readonly) RCTSurfacePresenter *surfacePresenter; // Introduced in 0.74
|
|
26
|
+
|
|
27
|
+
// Introduced in 0.74
|
|
28
|
+
- (instancetype)initWithBundleURLProvider:(RCTHostBundleURLProvider)provider
|
|
29
|
+
hostDelegate:(id<RCTHostDelegate>)hostDelegate
|
|
30
|
+
turboModuleManagerDelegate:
|
|
31
|
+
(id<RCTTurboModuleManagerDelegate>)turboModuleManagerDelegate
|
|
32
|
+
jsEngineProvider:(RCTHostJSEngineProvider)jsEngineProvider
|
|
33
|
+
launchOptions:(nullable NSDictionary *)launchOptions;
|
|
34
|
+
|
|
35
|
+
// Deprecated in 0.74
|
|
36
|
+
- (instancetype)initWithBundleURL:(NSURL *)bundleURL
|
|
37
|
+
hostDelegate:(id<RCTHostDelegate>)hostDelegate
|
|
38
|
+
turboModuleManagerDelegate:(id<RCTTurboModuleManagerDelegate>)turboModuleManagerDelegate
|
|
39
|
+
jsEngineProvider:(RCTHostJSEngineProvider)jsEngineProvider;
|
|
40
|
+
|
|
26
41
|
- (RCTModuleRegistry *)getModuleRegistry; // Deprecated in 0.74, and removed in 0.75
|
|
27
42
|
- (RCTSurfacePresenter *)getSurfacePresenter; // Deprecated in 0.74, and removed in 0.75
|
|
28
43
|
@end
|
package/cocoa/ReactNativeHost.h
CHANGED
|
@@ -24,8 +24,11 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
24
24
|
|
|
25
25
|
- (instancetype)init NS_UNAVAILABLE;
|
|
26
26
|
|
|
27
|
-
- (instancetype)initWithConfig:(id<RNXHostConfig>)config
|
|
28
|
-
|
|
27
|
+
- (instancetype)initWithConfig:(id<RNXHostConfig>)config NS_SWIFT_NAME(init(_:));
|
|
28
|
+
|
|
29
|
+
- (instancetype)initWithConfig:(id<RNXHostConfig>)config
|
|
30
|
+
launchOptions:(nullable NSDictionary *)launchOptions NS_DESIGNATED_INITIALIZER
|
|
31
|
+
NS_SWIFT_NAME(init(_:launchOptions:));
|
|
29
32
|
|
|
30
33
|
- (void)shutdown;
|
|
31
34
|
|
package/cocoa/ReactNativeHost.mm
CHANGED
|
@@ -31,6 +31,7 @@ using ReactNativeConfig = facebook::react::EmptyReactNativeConfig const;
|
|
|
31
31
|
|
|
32
32
|
@implementation ReactNativeHost {
|
|
33
33
|
__weak id<RNXHostConfig> _config;
|
|
34
|
+
NSDictionary *_launchOptions;
|
|
34
35
|
RNXTurboModuleAdapter *_turboModuleAdapter;
|
|
35
36
|
RCTSurfacePresenterBridgeAdapter *_surfacePresenterBridgeAdapter;
|
|
36
37
|
RCTBridge *_bridge;
|
|
@@ -41,6 +42,11 @@ using ReactNativeConfig = facebook::react::EmptyReactNativeConfig const;
|
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
- (instancetype)initWithConfig:(id<RNXHostConfig>)config
|
|
45
|
+
{
|
|
46
|
+
return [self initWithConfig:config launchOptions:nil];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
- (instancetype)initWithConfig:(id<RNXHostConfig>)config launchOptions:(NSDictionary *)launchOptions
|
|
44
50
|
{
|
|
45
51
|
if (self = [super init]) {
|
|
46
52
|
if ([config respondsToSelector:@selector(isDevLoadingViewEnabled)]) {
|
|
@@ -64,6 +70,7 @@ using ReactNativeConfig = facebook::react::EmptyReactNativeConfig const;
|
|
|
64
70
|
}
|
|
65
71
|
|
|
66
72
|
_config = config;
|
|
73
|
+
_launchOptions = launchOptions;
|
|
67
74
|
[self enableTurboModule];
|
|
68
75
|
_isShuttingDown = [[NSLock alloc] init];
|
|
69
76
|
|
|
@@ -90,7 +97,7 @@ using ReactNativeConfig = facebook::react::EmptyReactNativeConfig const;
|
|
|
90
97
|
|
|
91
98
|
@try {
|
|
92
99
|
if (_bridge == nil) {
|
|
93
|
-
_bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:
|
|
100
|
+
_bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:_launchOptions];
|
|
94
101
|
_surfacePresenterBridgeAdapter = RNXInstallSurfacePresenterBridgeAdapter(_bridge);
|
|
95
102
|
[_hostReleaser setBridge:_bridge];
|
|
96
103
|
}
|
|
@@ -250,12 +257,26 @@ using ReactNativeConfig = facebook::react::EmptyReactNativeConfig const;
|
|
|
250
257
|
#endif // USE_HERMES
|
|
251
258
|
};
|
|
252
259
|
|
|
253
|
-
_reactHost = [[RCTHost alloc] initWithBundleURL:[self sourceURLForBridge:nil]
|
|
254
|
-
hostDelegate:nil
|
|
255
|
-
turboModuleManagerDelegate:_turboModuleAdapter
|
|
256
|
-
jsEngineProvider:jsEngineProvider];
|
|
257
|
-
|
|
258
260
|
__weak __typeof(self) weakSelf = self;
|
|
261
|
+
if ([RCTHost instancesRespondToSelector:@selector
|
|
262
|
+
(initWithBundleURLProvider:
|
|
263
|
+
hostDelegate:turboModuleManagerDelegate:jsEngineProvider
|
|
264
|
+
:launchOptions:)]) {
|
|
265
|
+
_reactHost = [[RCTHost alloc]
|
|
266
|
+
initWithBundleURLProvider:^{
|
|
267
|
+
return [weakSelf sourceURLForBridge:nil];
|
|
268
|
+
}
|
|
269
|
+
hostDelegate:nil
|
|
270
|
+
turboModuleManagerDelegate:_turboModuleAdapter
|
|
271
|
+
jsEngineProvider:jsEngineProvider
|
|
272
|
+
launchOptions:_launchOptions];
|
|
273
|
+
} else {
|
|
274
|
+
_reactHost = [[RCTHost alloc] initWithBundleURL:[self sourceURLForBridge:nil]
|
|
275
|
+
hostDelegate:nil
|
|
276
|
+
turboModuleManagerDelegate:_turboModuleAdapter
|
|
277
|
+
jsEngineProvider:jsEngineProvider];
|
|
278
|
+
}
|
|
279
|
+
|
|
259
280
|
[_reactHost setBundleURLProvider:^NSURL *() {
|
|
260
281
|
return [weakSelf sourceURLForBridge:nil];
|
|
261
282
|
}];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rnx-kit/react-native-host",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.8",
|
|
4
4
|
"description": "Simplify React Native initialization",
|
|
5
5
|
"homepage": "https://github.com/microsoft/rnx-kit/tree/main/packages/react-native-host#readme",
|
|
6
6
|
"license": "MIT",
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
"android/build.gradle",
|
|
14
14
|
"android/gradle.properties",
|
|
15
15
|
"android/src",
|
|
16
|
-
"cocoa"
|
|
16
|
+
"cocoa",
|
|
17
|
+
"react-native.config.js"
|
|
17
18
|
],
|
|
18
19
|
"repository": {
|
|
19
20
|
"type": "git",
|