@rnx-kit/react-native-host 0.5.6 → 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.
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
#if USE_BRIDGELESS
|
|
2
2
|
|
|
3
|
+
// clang-format off
|
|
4
|
+
#import "RNXFeatureMacros.h"
|
|
5
|
+
// clang-format on
|
|
6
|
+
|
|
3
7
|
#import <React/RCTSurfacePresenterBridgeAdapter.h>
|
|
4
8
|
#import <ReactCommon/RCTHost+Internal.h>
|
|
5
9
|
#import <ReactCommon/RCTHost.h>
|
|
@@ -10,22 +14,19 @@
|
|
|
10
14
|
#import <ReactCommon/RCTJscInstance.h>
|
|
11
15
|
#endif // USE_HERMES
|
|
12
16
|
|
|
13
|
-
#
|
|
17
|
+
#ifdef USE_REACT_NATIVE_CONFIG
|
|
14
18
|
#import <react/config/ReactNativeConfig.h>
|
|
15
|
-
#
|
|
16
|
-
#endif // __has_include(<react/config/ReactNativeConfig.h>)
|
|
19
|
+
#endif // USE_REACT_NATIVE_CONFIG
|
|
17
20
|
|
|
18
|
-
#
|
|
21
|
+
#ifdef USE_FEATURE_FLAGS
|
|
19
22
|
#import <react/featureflags/ReactNativeFeatureFlags.h>
|
|
20
23
|
#import <react/featureflags/ReactNativeFeatureFlagsDefaults.h>
|
|
21
|
-
#
|
|
22
|
-
#endif // __has_include(<react/featureflags/ReactNativeFeatureFlags.h>)
|
|
24
|
+
#endif // USE_FEATURE_FLAGS
|
|
23
25
|
|
|
24
|
-
#
|
|
25
|
-
#define USE_CODEGEN_PROVIDER 1
|
|
26
|
+
#ifdef USE_CODEGEN_PROVIDER
|
|
26
27
|
#import <React/RCTComponentViewFactory.h>
|
|
27
28
|
#import <ReactCodegen/RCTThirdPartyComponentsProvider.h>
|
|
28
|
-
#endif //
|
|
29
|
+
#endif // USE_CODEGEN_PROVIDER
|
|
29
30
|
|
|
30
31
|
#if __has_include(<react/runtime/JSEngineInstance.h>)
|
|
31
32
|
using SharedJSRuntimeFactory = std::shared_ptr<facebook::react::JSEngineInstance>;
|
|
@@ -58,9 +59,6 @@ using SharedJSRuntimeFactory = std::shared_ptr<facebook::react::JSRuntimeFactory
|
|
|
58
59
|
@end
|
|
59
60
|
|
|
60
61
|
#ifdef USE_FEATURE_FLAGS
|
|
61
|
-
#if __has_include(<React-RCTAppDelegate/RCTArchConfiguratorProtocol.h>) || __has_include(<React_RCTAppDelegate/RCTArchConfiguratorProtocol.h>)
|
|
62
|
-
#define USE_UNIFIED_FEATURE_FLAGS 1
|
|
63
|
-
#endif // __has_include(<React-RCTAppDelegate/RCTArchConfiguratorProtocol.h>)
|
|
64
62
|
|
|
65
63
|
// https://github.com/facebook/react-native/blob/0.74-stable/packages/react-native/Libraries/AppDelegate/RCTAppDelegate.mm#L272-L286
|
|
66
64
|
class RNXBridgelessFeatureFlags : public facebook::react::ReactNativeFeatureFlagsDefaults
|
|
@@ -83,12 +81,22 @@ public:
|
|
|
83
81
|
{
|
|
84
82
|
return true;
|
|
85
83
|
}
|
|
86
|
-
#if
|
|
84
|
+
#if USE_VIEW_COMMAND_RACE_FIX // 0.77
|
|
87
85
|
bool enableFixForViewCommandRace() override
|
|
88
86
|
{
|
|
89
87
|
return true;
|
|
90
88
|
}
|
|
91
|
-
#endif
|
|
89
|
+
#endif // USE_VIEW_COMMAND_RACE_FIX
|
|
90
|
+
#if USE_UPDATE_RUNTIME_SHADOW_NODE_REFS_ON_COMMIT // >= 0.79
|
|
91
|
+
bool updateRuntimeShadowNodeReferencesOnCommit() override
|
|
92
|
+
{
|
|
93
|
+
return true;
|
|
94
|
+
}
|
|
95
|
+
bool useShadowNodeStateOnClone() override
|
|
96
|
+
{
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
99
|
+
#endif // USE_UPDATE_RUNTIME_SHADOW_NODE_REFS_ON_COMMIT
|
|
92
100
|
#else // < 0.77
|
|
93
101
|
bool useModernRuntimeScheduler() override
|
|
94
102
|
{
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#if USE_BRIDGELESS
|
|
2
|
+
|
|
3
|
+
#if __has_include(<react/config/ReactNativeConfig.h>)
|
|
4
|
+
#define USE_REACT_NATIVE_CONFIG 1
|
|
5
|
+
#endif // __has_include(<react/config/ReactNativeConfig.h>)
|
|
6
|
+
|
|
7
|
+
#if __has_include(<react/featureflags/ReactNativeFeatureFlags.h>)
|
|
8
|
+
#define USE_FEATURE_FLAGS 1
|
|
9
|
+
#endif // __has_include(<react/featureflags/ReactNativeFeatureFlags.h>)
|
|
10
|
+
|
|
11
|
+
#if __has_include(<ReactCodegen/RCTThirdPartyComponentsProvider.h>)
|
|
12
|
+
#define USE_CODEGEN_PROVIDER 1
|
|
13
|
+
#endif // __has_include(<ReactCodegen/RCTThirdPartyComponentsProvider.h>)
|
|
14
|
+
|
|
15
|
+
#ifdef USE_FEATURE_FLAGS
|
|
16
|
+
|
|
17
|
+
#if __has_include(<React-RCTAppDelegate/RCTArchConfiguratorProtocol.h>) || __has_include(<React_RCTAppDelegate/RCTArchConfiguratorProtocol.h>)
|
|
18
|
+
#define USE_UNIFIED_FEATURE_FLAGS 1
|
|
19
|
+
#endif // __has_include(<React-RCTAppDelegate/RCTArchConfiguratorProtocol.h>)
|
|
20
|
+
|
|
21
|
+
#if !__has_include(<React-RCTAppDelegate/RCTReactNativeFactory.h>) && !__has_include(<React_RCTAppDelegate/RCTReactNativeFactory.h>)
|
|
22
|
+
#define USE_VIEW_COMMAND_RACE_FIX 1
|
|
23
|
+
#endif // !__has_include(<React-RCTAppDelegate/RCTReactNativeFactory.h>)
|
|
24
|
+
|
|
25
|
+
#if __has_include(<React-RCTAppDelegate/RCTJSRuntimeConfiguratorProtocol.h>) || __has_include(<React_RCTAppDelegate/RCTJSRuntimeConfiguratorProtocol.h>)
|
|
26
|
+
#define USE_UPDATE_RUNTIME_SHADOW_NODE_REFS_ON_COMMIT 1
|
|
27
|
+
#endif // __has_include(<React-RCTAppDelegate/RCTJSRuntimeConfiguratorProtocol.h>)
|
|
28
|
+
|
|
29
|
+
#endif // USE_FEATURE_FLAGS
|
|
30
|
+
|
|
31
|
+
#endif // USE_BRIDGELESS
|
|
@@ -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