@rnx-kit/react-native-host 0.5.1 → 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>
|
|
@@ -49,10 +52,36 @@ using SharedJSRuntimeFactory = std::shared_ptr<facebook::react::JSRuntimeFactory
|
|
|
49
52
|
@end
|
|
50
53
|
|
|
51
54
|
#ifdef USE_FEATURE_FLAGS
|
|
55
|
+
#if __has_include(<React-RCTAppDelegate/RCTArchConfiguratorProtocol.h>) || __has_include(<React_RCTAppDelegate/RCTArchConfiguratorProtocol.h>)
|
|
56
|
+
#define USE_UNIFIED_FEATURE_FLAGS 1
|
|
57
|
+
#endif // __has_include(<React-RCTAppDelegate/RCTArchConfiguratorProtocol.h>)
|
|
58
|
+
|
|
52
59
|
// https://github.com/facebook/react-native/blob/0.74-stable/packages/react-native/Libraries/AppDelegate/RCTAppDelegate.mm#L272-L286
|
|
53
60
|
class RNXBridgelessFeatureFlags : public facebook::react::ReactNativeFeatureFlagsDefaults
|
|
54
61
|
{
|
|
55
62
|
public:
|
|
63
|
+
#ifdef USE_UNIFIED_FEATURE_FLAGS // >= 0.77
|
|
64
|
+
bool enableBridgelessArchitecture() override
|
|
65
|
+
{
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
bool enableFabricRenderer() override
|
|
69
|
+
{
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
bool useTurboModules() override
|
|
73
|
+
{
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
76
|
+
bool useNativeViewConfigsInBridgelessMode() override
|
|
77
|
+
{
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
bool enableFixForViewCommandRace() override
|
|
81
|
+
{
|
|
82
|
+
return true;
|
|
83
|
+
}
|
|
84
|
+
#else // < 0.77
|
|
56
85
|
bool useModernRuntimeScheduler() override
|
|
57
86
|
{
|
|
58
87
|
return true;
|
|
@@ -67,6 +96,7 @@ public:
|
|
|
67
96
|
{
|
|
68
97
|
return true;
|
|
69
98
|
}
|
|
99
|
+
#endif // USE_UNIFIED_FEATURE_FLAGS
|
|
70
100
|
};
|
|
71
101
|
#endif // USE_FEATURE_FLAGS
|
|
72
102
|
|
|
@@ -98,7 +98,11 @@
|
|
|
98
98
|
|
|
99
99
|
- (id<RCTTurboModule>)getModuleInstanceFromClass:(Class)moduleClass
|
|
100
100
|
{
|
|
101
|
+
#if __has_include(<React-RCTAppDelegate/RCTDependencyProvider.h>) || __has_include(<React_RCTAppDelegate/RCTDependencyProvider.h>)
|
|
102
|
+
return RCTAppSetupDefaultModuleFromClass(moduleClass, nil);
|
|
103
|
+
#else
|
|
101
104
|
return RCTAppSetupDefaultModuleFromClass(moduleClass);
|
|
105
|
+
#endif // __has_include(<React-RCTAppDelegate/RCTArchConfiguratorProtocol.h>)
|
|
102
106
|
}
|
|
103
107
|
|
|
104
108
|
// MARK: - Private
|
|
@@ -59,10 +59,7 @@ static NSString *const kReactConcurrentRoot = @"concurrentRoot";
|
|
|
59
59
|
#elif USE_BRIDGELESS
|
|
60
60
|
RCTFabricSurface *surface = [self.reactHost createSurfaceWithModuleName:moduleName
|
|
61
61
|
initialProperties:initialProps];
|
|
62
|
-
|
|
63
|
-
RCTSurfaceSizeMeasureModeWidthExact | RCTSurfaceSizeMeasureModeHeightExact;
|
|
64
|
-
return [[RCTSurfaceHostingProxyRootView alloc] initWithSurface:surface
|
|
65
|
-
sizeMeasureMode:sizeMeasureMode];
|
|
62
|
+
return [[RCTSurfaceHostingProxyRootView alloc] initWithSurface:surface];
|
|
66
63
|
#else
|
|
67
64
|
RCTFabricSurface *surface =
|
|
68
65
|
[[RCTFabricSurface alloc] initWithSurfacePresenter:self.surfacePresenter
|
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
|
|
@@ -248,19 +254,27 @@ using ReactNativeConfig = facebook::react::EmptyReactNativeConfig const;
|
|
|
248
254
|
}
|
|
249
255
|
|
|
250
256
|
#if USE_BRIDGELESS
|
|
257
|
+
#ifndef USE_UNIFIED_FEATURE_FLAGS
|
|
251
258
|
RCTSetUseNativeViewConfigsInBridgelessMode(YES);
|
|
259
|
+
#endif
|
|
252
260
|
RCTEnableTurboModuleInterop(YES);
|
|
253
261
|
RCTEnableTurboModuleInteropBridgeProxy(YES);
|
|
254
262
|
|
|
263
|
+
#ifdef USE_REACT_NATIVE_CONFIG
|
|
255
264
|
_reactNativeConfig = std::make_shared<ReactNativeConfig>();
|
|
256
265
|
std::weak_ptr<ReactNativeConfig> reactNativeConfig{_reactNativeConfig};
|
|
266
|
+
#endif // USE_REACT_NATIVE_CONFIG
|
|
257
267
|
|
|
258
268
|
SharedJSRuntimeFactory (^jsEngineProvider)() = ^SharedJSRuntimeFactory {
|
|
259
269
|
#if USE_HERMES
|
|
270
|
+
#ifdef USE_REACT_NATIVE_CONFIG
|
|
260
271
|
auto config = reactNativeConfig.lock();
|
|
261
272
|
NSAssert(config, @"Expected nonnull ReactNativeConfig instance");
|
|
262
273
|
return std::make_shared<facebook::react::RCTHermesInstance>(config, nullptr);
|
|
263
274
|
#else
|
|
275
|
+
return std::make_shared<facebook::react::RCTHermesInstance>(nullptr, false);
|
|
276
|
+
#endif // USE_REACT_NATIVE_CONFIG
|
|
277
|
+
#else // USE_HERMES
|
|
264
278
|
return std::make_shared<facebook::react::RCTJscInstance>();
|
|
265
279
|
#endif // USE_HERMES
|
|
266
280
|
};
|
package/package.json
CHANGED