@rnx-kit/react-native-host 0.2.8 → 0.2.9
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.
package/ReactNativeHost.podspec
CHANGED
|
@@ -17,7 +17,7 @@ if new_arch_enabled
|
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
Pod::Spec.new do |s|
|
|
20
|
-
s.name = '
|
|
20
|
+
s.name = File.basename(__FILE__, '.podspec')
|
|
21
21
|
s.version = version
|
|
22
22
|
s.author = { package['author']['name'] => package['author']['email'] }
|
|
23
23
|
s.license = package['license']
|
|
@@ -38,6 +38,7 @@ Pod::Spec.new do |s|
|
|
|
38
38
|
if new_arch_enabled
|
|
39
39
|
s.dependency 'React-RCTAppDelegate'
|
|
40
40
|
s.dependency 'React-RCTFabric'
|
|
41
|
+
s.dependency 'Yoga'
|
|
41
42
|
end
|
|
42
43
|
|
|
43
44
|
s.pod_target_xcconfig = {
|
|
@@ -50,6 +51,7 @@ Pod::Spec.new do |s|
|
|
|
50
51
|
'$(PODS_ROOT)/RCT-Folly',
|
|
51
52
|
'$(PODS_ROOT)/DoubleConversion',
|
|
52
53
|
'$(PODS_ROOT)/Headers/Private/React-Core',
|
|
54
|
+
'$(PODS_ROOT)/Headers/Private/Yoga',
|
|
53
55
|
],
|
|
54
56
|
}
|
|
55
57
|
|
|
@@ -21,13 +21,17 @@
|
|
|
21
21
|
// 0.72 bits. AFAICT, `RCTLegacyInteropComponents.h` is a new addition in 0.72
|
|
22
22
|
// in both react-native and react-native-macos.
|
|
23
23
|
#if __has_include(<React-RCTAppDelegate/RCTLegacyInteropComponents.h>)
|
|
24
|
+
#import <React-RCTAppDelegate/RCTLegacyInteropComponents.h>
|
|
25
|
+
#import <React/RCTLegacyViewManagerInteropComponentView.h>
|
|
24
26
|
#import <react/renderer/runtimescheduler/RuntimeScheduler.h>
|
|
25
27
|
#import <react/renderer/runtimescheduler/RuntimeSchedulerCallInvoker.h>
|
|
26
28
|
#if __has_include(<React/RCTRuntimeExecutorFromBridge.h>)
|
|
27
29
|
#import <React/RCTRuntimeExecutorFromBridge.h>
|
|
28
30
|
#endif // __has_include(<React/RCTRuntimeExecutorFromBridge.h>)
|
|
31
|
+
#define SUPPORTS_LEGACY_COMPONENTS 1
|
|
29
32
|
#define USE_RUNTIME_SCHEDULER 1
|
|
30
33
|
#else
|
|
34
|
+
#define SUPPORTS_LEGACY_COMPONENTS 0
|
|
31
35
|
#define USE_RUNTIME_SCHEDULER 0
|
|
32
36
|
#endif // __has_include(<React-RCTAppDelegate/RCTLegacyInteropComponents.h>)
|
|
33
37
|
|
|
@@ -48,31 +52,19 @@
|
|
|
48
52
|
(RCTBridge *)bridge
|
|
49
53
|
{
|
|
50
54
|
#if USE_TURBOMODULE
|
|
55
|
+
[self registerLegacyViewManagers];
|
|
51
56
|
// jsExecutorFactoryForBridge: (USE_TURBOMODULE=1)
|
|
52
|
-
|
|
53
|
-
_runtimeScheduler =
|
|
54
|
-
std::make_shared<facebook::react::RuntimeScheduler>(RCTRuntimeExecutorFromBridge(bridge));
|
|
55
|
-
auto callInvoker =
|
|
56
|
-
std::make_shared<facebook::react::RuntimeSchedulerCallInvoker>(_runtimeScheduler);
|
|
57
|
-
_turboModuleManager = [[RCTTurboModuleManager alloc] initWithBridge:bridge
|
|
58
|
-
delegate:self
|
|
59
|
-
jsInvoker:callInvoker];
|
|
60
|
-
return RCTAppSetupDefaultJsExecutorFactory(bridge, _turboModuleManager, _runtimeScheduler);
|
|
61
|
-
#else
|
|
62
|
-
_turboModuleManager = [[RCTTurboModuleManager alloc] initWithBridge:bridge
|
|
63
|
-
delegate:self
|
|
64
|
-
jsInvoker:bridge.jsCallInvoker];
|
|
65
|
-
return RCTAppSetupDefaultJsExecutorFactory(bridge, _turboModuleManager);
|
|
66
|
-
#endif // USE_RUNTIME_SCHEDULER
|
|
57
|
+
return [self initJsExecutorFactoryWithBridge:bridge];
|
|
67
58
|
#else
|
|
68
59
|
// jsExecutorFactoryForBridge: (USE_TURBOMODULE=0)
|
|
69
60
|
return nullptr;
|
|
70
61
|
#endif // USE_TURBOMODULE
|
|
71
62
|
}
|
|
72
63
|
|
|
73
|
-
// MARK: - RCTTurboModuleManagerDelegate details
|
|
74
64
|
#if USE_TURBOMODULE
|
|
75
65
|
|
|
66
|
+
// MARK: - RCTTurboModuleManagerDelegate details
|
|
67
|
+
|
|
76
68
|
- (Class)getModuleClassFromName:(const char *)name
|
|
77
69
|
{
|
|
78
70
|
return RCTCoreModulesClassProvider(name);
|
|
@@ -90,6 +82,36 @@
|
|
|
90
82
|
return RCTAppSetupDefaultModuleFromClass(moduleClass);
|
|
91
83
|
}
|
|
92
84
|
|
|
85
|
+
// MARK: - Private
|
|
86
|
+
|
|
87
|
+
- (std::unique_ptr<facebook::react::JSExecutorFactory>)initJsExecutorFactoryWithBridge:(RCTBridge *)bridge
|
|
88
|
+
{
|
|
89
|
+
#if USE_RUNTIME_SCHEDULER
|
|
90
|
+
_runtimeScheduler =
|
|
91
|
+
std::make_shared<facebook::react::RuntimeScheduler>(RCTRuntimeExecutorFromBridge(bridge));
|
|
92
|
+
auto callInvoker =
|
|
93
|
+
std::make_shared<facebook::react::RuntimeSchedulerCallInvoker>(_runtimeScheduler);
|
|
94
|
+
_turboModuleManager = [[RCTTurboModuleManager alloc] initWithBridge:bridge
|
|
95
|
+
delegate:self
|
|
96
|
+
jsInvoker:callInvoker];
|
|
97
|
+
return RCTAppSetupDefaultJsExecutorFactory(bridge, _turboModuleManager, _runtimeScheduler);
|
|
98
|
+
#else
|
|
99
|
+
_turboModuleManager = [[RCTTurboModuleManager alloc] initWithBridge:bridge
|
|
100
|
+
delegate:self
|
|
101
|
+
jsInvoker:bridge.jsCallInvoker];
|
|
102
|
+
return RCTAppSetupDefaultJsExecutorFactory(bridge, _turboModuleManager);
|
|
103
|
+
#endif // USE_RUNTIME_SCHEDULER
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
- (void)registerLegacyViewManagers
|
|
107
|
+
{
|
|
108
|
+
#if SUPPORTS_LEGACY_COMPONENTS
|
|
109
|
+
for (NSString *legacyComponent in [RCTLegacyInteropComponents legacyInteropComponents]) {
|
|
110
|
+
[RCTLegacyViewManagerInteropComponentView supportLegacyViewManagerWithName:legacyComponent];
|
|
111
|
+
}
|
|
112
|
+
#endif // SUPPORTS_LEGACY_COMPONENTS
|
|
113
|
+
}
|
|
114
|
+
|
|
93
115
|
#endif // USE_TURBOMODULE
|
|
94
116
|
|
|
95
117
|
@end
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
#import "ReactNativeHost.h"
|
|
2
2
|
|
|
3
3
|
#ifdef USE_FABRIC
|
|
4
|
+
#if __has_include(<React/RCTFabricSurfaceHostingProxyRootView.h>)
|
|
4
5
|
#import <React/RCTFabricSurfaceHostingProxyRootView.h>
|
|
5
6
|
#else
|
|
7
|
+
#import <React/RCTFabricSurface.h>
|
|
8
|
+
#import <React/RCTSurfaceHostingProxyRootView.h>
|
|
9
|
+
#endif // __has_include(<React/RCTFabricSurfaceHostingProxyRootView.h>)
|
|
10
|
+
#else
|
|
6
11
|
#import <React/RCTRootView.h>
|
|
7
12
|
#endif // USE_FABRIC
|
|
8
13
|
|
|
@@ -31,9 +36,16 @@
|
|
|
31
36
|
initialProperties:(NSDictionary *)initialProperties;
|
|
32
37
|
{
|
|
33
38
|
#ifdef USE_FABRIC
|
|
39
|
+
#if __has_include(<React/RCTFabricSurfaceHostingProxyRootView.h>)
|
|
34
40
|
return [[RCTFabricSurfaceHostingProxyRootView alloc] initWithBridge:self.bridge
|
|
35
41
|
moduleName:moduleName
|
|
36
42
|
initialProperties:initialProperties];
|
|
43
|
+
#else
|
|
44
|
+
RCTFabricSurface *surface = [[RCTFabricSurface alloc] initWithBridge:self.bridge
|
|
45
|
+
moduleName:moduleName
|
|
46
|
+
initialProperties:initialProperties];
|
|
47
|
+
return [[RCTSurfaceHostingProxyRootView alloc] initWithSurface:surface];
|
|
48
|
+
#endif // __has_include(<React/RCTFabricSurfaceHostingProxyRootView.h>)
|
|
37
49
|
#else
|
|
38
50
|
return [[RCTRootView alloc] initWithBridge:self.bridge
|
|
39
51
|
moduleName:moduleName
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rnx-kit/react-native-host",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.9",
|
|
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",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"scripts": {
|
|
22
22
|
"format": "rnx-kit-scripts format",
|
|
23
23
|
"format:c": "clang-format -i $(git ls-files '*.c' '*.cpp' '*.h' '*.m' '*.mm')",
|
|
24
|
-
"lint:kt": "ktlint --relative
|
|
24
|
+
"lint:kt": "ktlint --relative 'android/src/**/*.kt'"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"react-native": ">=0.64"
|