@rnx-kit/react-native-host 0.5.2 → 0.5.3
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.
|
@@ -10,7 +10,10 @@
|
|
|
10
10
|
#import <ReactCommon/RCTJscInstance.h>
|
|
11
11
|
#endif // USE_HERMES
|
|
12
12
|
|
|
13
|
+
#if __has_include(<react/config/ReactNativeConfig.h>)
|
|
13
14
|
#import <react/config/ReactNativeConfig.h>
|
|
15
|
+
#define USE_REACT_NATIVE_CONFIG
|
|
16
|
+
#endif // __has_include(<react/config/ReactNativeConfig.h>)
|
|
14
17
|
|
|
15
18
|
#if __has_include(<react/featureflags/ReactNativeFeatureFlags.h>)
|
|
16
19
|
#import <react/featureflags/ReactNativeFeatureFlags.h>
|
package/cocoa/ReactNativeHost.mm
CHANGED
|
@@ -16,7 +16,9 @@
|
|
|
16
16
|
|
|
17
17
|
@class RCTSurfacePresenter;
|
|
18
18
|
|
|
19
|
+
#ifdef USE_REACT_NATIVE_CONFIG
|
|
19
20
|
using ReactNativeConfig = facebook::react::EmptyReactNativeConfig const;
|
|
21
|
+
#endif // USE_REACT_NATIVE_CONFIG
|
|
20
22
|
|
|
21
23
|
#if USE_BRIDGELESS
|
|
22
24
|
@interface ReactNativeHost () <RCTContextContainerHandling>
|
|
@@ -34,7 +36,9 @@ using ReactNativeConfig = facebook::react::EmptyReactNativeConfig const;
|
|
|
34
36
|
RCTHost *_reactHost;
|
|
35
37
|
NSLock *_isShuttingDown;
|
|
36
38
|
RNXHostReleaser *_hostReleaser;
|
|
39
|
+
#ifdef USE_REACT_NATIVE_CONFIG
|
|
37
40
|
std::shared_ptr<ReactNativeConfig> _reactNativeConfig;
|
|
41
|
+
#endif // USE_REACT_NATIVE_CONFIG
|
|
38
42
|
}
|
|
39
43
|
|
|
40
44
|
- (instancetype)initWithConfig:(id<RNXHostConfig>)config
|
|
@@ -197,7 +201,9 @@ using ReactNativeConfig = facebook::react::EmptyReactNativeConfig const;
|
|
|
197
201
|
- (void)didCreateContextContainer:
|
|
198
202
|
(std::shared_ptr<facebook::react::ContextContainer>)contextContainer
|
|
199
203
|
{
|
|
204
|
+
#ifdef USE_REACT_NATIVE_CONFIG
|
|
200
205
|
contextContainer->insert("ReactNativeConfig", _reactNativeConfig);
|
|
206
|
+
#endif // USE_REACT_NATIVE_CONFIG
|
|
201
207
|
}
|
|
202
208
|
|
|
203
209
|
#else // USE_BRIDGELESS
|
|
@@ -254,15 +260,21 @@ using ReactNativeConfig = facebook::react::EmptyReactNativeConfig const;
|
|
|
254
260
|
RCTEnableTurboModuleInterop(YES);
|
|
255
261
|
RCTEnableTurboModuleInteropBridgeProxy(YES);
|
|
256
262
|
|
|
263
|
+
#ifdef USE_REACT_NATIVE_CONFIG
|
|
257
264
|
_reactNativeConfig = std::make_shared<ReactNativeConfig>();
|
|
258
265
|
std::weak_ptr<ReactNativeConfig> reactNativeConfig{_reactNativeConfig};
|
|
266
|
+
#endif // USE_REACT_NATIVE_CONFIG
|
|
259
267
|
|
|
260
268
|
SharedJSRuntimeFactory (^jsEngineProvider)() = ^SharedJSRuntimeFactory {
|
|
261
269
|
#if USE_HERMES
|
|
270
|
+
#ifdef USE_REACT_NATIVE_CONFIG
|
|
262
271
|
auto config = reactNativeConfig.lock();
|
|
263
272
|
NSAssert(config, @"Expected nonnull ReactNativeConfig instance");
|
|
264
273
|
return std::make_shared<facebook::react::RCTHermesInstance>(config, nullptr);
|
|
265
274
|
#else
|
|
275
|
+
return std::make_shared<facebook::react::RCTHermesInstance>(nullptr, false);
|
|
276
|
+
#endif // USE_REACT_NATIVE_CONFIG
|
|
277
|
+
#else // USE_HERMES
|
|
266
278
|
return std::make_shared<facebook::react::RCTJscInstance>();
|
|
267
279
|
#endif // USE_HERMES
|
|
268
280
|
};
|
package/package.json
CHANGED