@rnx-kit/react-native-host 0.3.1 → 0.4.0

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.
@@ -20,7 +20,6 @@ preprocessor_definitions = [
20
20
  if new_arch_enabled
21
21
  preprocessor_definitions << 'RCT_NEW_ARCH_ENABLED=1'
22
22
  preprocessor_definitions << 'USE_FABRIC=1'
23
- preprocessor_definitions << 'USE_TURBOMODULE=1'
24
23
  end
25
24
 
26
25
  Pod::Spec.new do |s|
@@ -2,9 +2,9 @@
2
2
 
3
3
  #import <Foundation/Foundation.h>
4
4
 
5
- #if USE_TURBOMODULE
5
+ #if USE_FABRIC
6
6
  #import <ReactCommon/RCTTurboModuleManager.h>
7
- #endif // USE_TURBOMODULE
7
+ #endif // USE_FABRIC
8
8
 
9
9
  @class RCTBridge;
10
10
 
@@ -15,11 +15,11 @@ namespace facebook::react
15
15
 
16
16
  NS_ASSUME_NONNULL_BEGIN
17
17
 
18
- #if USE_TURBOMODULE
18
+ #if USE_FABRIC
19
19
  @interface RNXTurboModuleAdapter : NSObject <RCTTurboModuleManagerDelegate>
20
20
  #else
21
21
  @interface RNXTurboModuleAdapter : NSObject
22
- #endif // USE_TURBOMODULE
22
+ #endif // USE_FABRIC
23
23
 
24
24
  - (std::unique_ptr<facebook::react::JSExecutorFactory>)jsExecutorFactoryForBridge:
25
25
  (RCTBridge *)bridge;
@@ -6,43 +6,41 @@
6
6
  #import <cxxreact/JSExecutor.h>
7
7
  #pragma clang diagnostic pop
8
8
 
9
- #if USE_TURBOMODULE
9
+ #if USE_FABRIC
10
10
  #import <React/CoreModulesPlugins.h>
11
11
  #import <ReactCommon/RCTTurboModuleManager.h>
12
12
 
13
13
  #if __has_include(<React/RCTAppSetupUtils.h>) // <0.72
14
14
  #import <React/RCTAppSetupUtils.h>
15
- #define USE_RUNTIME_SCHEDULER 0
16
15
  #else
17
16
  #import <React-RCTAppDelegate/RCTAppSetupUtils.h>
18
17
  #import <React/RCTSurfacePresenterBridgeAdapter.h>
19
18
 
20
19
  // We still get into this path because react-native-macos 0.71 picked up some
21
- // 0.72 bits. AFAICT, `RCTLegacyInteropComponents.h` is a new addition in 0.72
22
- // in both react-native and react-native-macos.
23
- #if __has_include(<React-RCTAppDelegate/RCTLegacyInteropComponents.h>)
20
+ // 0.72 bits. AFAICT, `SchedulerPriorityUtils.h` is a new addition in 0.72 in
21
+ // both react-native and react-native-macos.
22
+ #if __has_include(<react/renderer/runtimescheduler/SchedulerPriorityUtils.h>)
23
+ #if __has_include(<React-RCTAppDelegate/RCTLegacyInteropComponents.h>) // <0.74
24
24
  #import <React-RCTAppDelegate/RCTLegacyInteropComponents.h>
25
+ #define MANUALLY_REGISTER_LEGACY_COMPONENTS 1
26
+ #endif // __has_include(<React-RCTAppDelegate/RCTLegacyInteropComponents.h>)
25
27
  #import <React/RCTLegacyViewManagerInteropComponentView.h>
26
28
  #import <react/renderer/runtimescheduler/RuntimeScheduler.h>
27
29
  #import <react/renderer/runtimescheduler/RuntimeSchedulerCallInvoker.h>
28
30
  #if __has_include(<React/RCTRuntimeExecutorFromBridge.h>)
29
31
  #import <React/RCTRuntimeExecutorFromBridge.h>
30
32
  #endif // __has_include(<React/RCTRuntimeExecutorFromBridge.h>)
31
- #define SUPPORTS_LEGACY_COMPONENTS 1
32
33
  #define USE_RUNTIME_SCHEDULER 1
33
- #else
34
- #define SUPPORTS_LEGACY_COMPONENTS 0
35
- #define USE_RUNTIME_SCHEDULER 0
36
- #endif // __has_include(<React-RCTAppDelegate/RCTLegacyInteropComponents.h>)
34
+ #endif // __has_include(<react/renderer/runtimescheduler/SchedulerPriorityUtils.h>)
37
35
 
38
36
  #endif // __has_include(<React/RCTAppSetupUtils.h>)
39
37
 
40
- #endif // USE_TURBOMODULE
38
+ #endif // USE_FABRIC
41
39
 
42
40
  @implementation RNXTurboModuleAdapter {
43
- #if USE_TURBOMODULE
41
+ #if USE_FABRIC
44
42
  RCTTurboModuleManager *_turboModuleManager;
45
- #endif // USE_TURBOMODULE
43
+ #endif // USE_FABRIC
46
44
  #if USE_RUNTIME_SCHEDULER
47
45
  std::shared_ptr<facebook::react::RuntimeScheduler> _runtimeScheduler;
48
46
  #endif // USE_RUNTIME_SCHEDULER
@@ -51,17 +49,21 @@
51
49
  - (std::unique_ptr<facebook::react::JSExecutorFactory>)jsExecutorFactoryForBridge:
52
50
  (RCTBridge *)bridge
53
51
  {
54
- #if USE_TURBOMODULE
55
- [self registerLegacyViewManagers];
56
- // jsExecutorFactoryForBridge: (USE_TURBOMODULE=1)
52
+ #if USE_FABRIC
53
+ #if MANUALLY_REGISTER_LEGACY_COMPONENTS
54
+ for (NSString *legacyComponent in [RCTLegacyInteropComponents legacyInteropComponents]) {
55
+ [RCTLegacyViewManagerInteropComponentView supportLegacyViewManagerWithName:legacyComponent];
56
+ }
57
+ #endif // MANUALLY_REGISTER_LEGACY_COMPONENTS
58
+ // jsExecutorFactoryForBridge: (USE_FABRIC=1)
57
59
  return [self initJsExecutorFactoryWithBridge:bridge];
58
60
  #else
59
- // jsExecutorFactoryForBridge: (USE_TURBOMODULE=0)
61
+ // jsExecutorFactoryForBridge: (USE_FABRIC=0)
60
62
  return nullptr;
61
- #endif // USE_TURBOMODULE
63
+ #endif // USE_FABRIC
62
64
  }
63
65
 
64
- #if USE_TURBOMODULE
66
+ #if USE_FABRIC
65
67
 
66
68
  // MARK: - RCTTurboModuleManagerDelegate details
67
69
 
@@ -104,15 +106,6 @@
104
106
  #endif // USE_RUNTIME_SCHEDULER
105
107
  }
106
108
 
107
- - (void)registerLegacyViewManagers
108
- {
109
- #if SUPPORTS_LEGACY_COMPONENTS
110
- for (NSString *legacyComponent in [RCTLegacyInteropComponents legacyInteropComponents]) {
111
- [RCTLegacyViewManagerInteropComponentView supportLegacyViewManagerWithName:legacyComponent];
112
- }
113
- #endif // SUPPORTS_LEGACY_COMPONENTS
114
- }
115
-
116
- #endif // USE_TURBOMODULE
109
+ #endif // USE_FABRIC
117
110
 
118
111
  @end
@@ -53,7 +53,7 @@
53
53
  }
54
54
 
55
55
  _config = config;
56
- #if USE_FABRIC || USE_TURBOMODULE
56
+ #if USE_FABRIC
57
57
  _turboModuleAdapter = [[RNXTurboModuleAdapter alloc] init];
58
58
  #endif
59
59
  _isShuttingDown = [[NSLock alloc] init];
@@ -144,13 +144,13 @@
144
144
  - (std::unique_ptr<facebook::react::JSExecutorFactory>)jsExecutorFactoryForBridge:
145
145
  (RCTBridge *)bridge
146
146
  {
147
- #if USE_TURBOMODULE
148
- // jsExecutorFactoryForBridge: (USE_TURBOMODULE=1)
147
+ #if USE_FABRIC
148
+ // jsExecutorFactoryForBridge: (USE_FABRIC=1)
149
149
  return [_turboModuleAdapter jsExecutorFactoryForBridge:bridge];
150
150
  #else
151
- // jsExecutorFactoryForBridge: (USE_TURBOMODULE=0)
151
+ // jsExecutorFactoryForBridge: (USE_FABRIC=0)
152
152
  return nullptr;
153
- #endif // USE_TURBOMODULE
153
+ #endif // USE_FABRIC
154
154
  }
155
155
 
156
156
  // MARK: - Private
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rnx-kit/react-native-host",
3
- "version": "0.3.1",
3
+ "version": "0.4.0",
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",