@rnx-kit/react-native-host 0.5.5 → 0.5.7

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
- #if __has_include(<react/config/ReactNativeConfig.h>)
17
+ #ifdef USE_REACT_NATIVE_CONFIG
14
18
  #import <react/config/ReactNativeConfig.h>
15
- #define USE_REACT_NATIVE_CONFIG
16
- #endif // __has_include(<react/config/ReactNativeConfig.h>)
19
+ #endif // USE_REACT_NATIVE_CONFIG
17
20
 
18
- #if __has_include(<react/featureflags/ReactNativeFeatureFlags.h>)
21
+ #ifdef USE_FEATURE_FLAGS
19
22
  #import <react/featureflags/ReactNativeFeatureFlags.h>
20
23
  #import <react/featureflags/ReactNativeFeatureFlagsDefaults.h>
21
- #define USE_FEATURE_FLAGS
22
- #endif // __has_include(<react/featureflags/ReactNativeFeatureFlags.h>)
24
+ #endif // USE_FEATURE_FLAGS
23
25
 
24
- #if __has_include(<ReactCodegen/RCTThirdPartyComponentsProvider.h>)
25
- #define USE_CODEGEN_PROVIDER 1
26
- #import <ReactCodegen/RCTThirdPartyComponentsProvider.h>
26
+ #ifdef USE_CODEGEN_PROVIDER
27
27
  #import <React/RCTComponentViewFactory.h>
28
- #endif // __has_include(<ReactCodegen/RCTThirdPartyComponentsProvider.h>)
28
+ #import <ReactCodegen/RCTThirdPartyComponentsProvider.h>
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 !__has_include(<React-RCTAppDelegate/RCTReactNativeFactory.h>) && !__has_include(<React_RCTAppDelegate/RCTReactNativeFactory.h>) // 0.77
84
+ #if USE_VIEW_COMMAND_RACE_FIX // 0.77
87
85
  bool enableFixForViewCommandRace() override
88
86
  {
89
87
  return true;
90
88
  }
91
- #endif // 0.77
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
@@ -1,6 +1,7 @@
1
1
  #include <memory>
2
2
 
3
3
  #import <Foundation/Foundation.h>
4
+ #include <cxxreact/JSExecutor.h>
4
5
 
5
6
  #if USE_FABRIC
6
7
  #import <ReactCommon/RCTTurboModuleManager.h>
@@ -8,11 +9,6 @@
8
9
 
9
10
  @class RCTBridge;
10
11
 
11
- namespace facebook::react
12
- {
13
- class JSExecutorFactory;
14
- } // namespace facebook::react
15
-
16
12
  NS_ASSUME_NONNULL_BEGIN
17
13
 
18
14
  #if USE_FABRIC
@@ -59,8 +59,19 @@ static NSString *const kReactConcurrentRoot = @"concurrentRoot";
59
59
  #elif USE_BRIDGELESS
60
60
  RCTFabricSurface *surface = [self.reactHost createSurfaceWithModuleName:moduleName
61
61
  initialProperties:initialProps];
62
+ #if __has_include(<react/renderer/graphics/LinearGradient.h>) // >=0.77
62
63
  return [[RCTSurfaceHostingProxyRootView alloc] initWithSurface:surface];
63
64
  #else
65
+ // `-initWithSurface:` implicitly calls `start` and causes race conditions.
66
+ // This was fixed in 0.76.7, but for backwards compatibility, we should call
67
+ // `-initWithSurface:sizeMeasureMode` when possible. For more details, see
68
+ // https://github.com/facebook/react-native/pull/47313.
69
+ RCTSurfaceSizeMeasureMode sizeMeasureMode =
70
+ RCTSurfaceSizeMeasureModeWidthExact | RCTSurfaceSizeMeasureModeHeightExact;
71
+ return [[RCTSurfaceHostingProxyRootView alloc] initWithSurface:surface
72
+ sizeMeasureMode:sizeMeasureMode];
73
+ #endif // __has_include(<react/renderer/graphics/LinearGradient.h>)
74
+ #else // __has_include(<React/RCTFabricSurfaceHostingProxyRootView.h>)
64
75
  RCTFabricSurface *surface =
65
76
  [[RCTFabricSurface alloc] initWithSurfacePresenter:self.surfacePresenter
66
77
  moduleName:moduleName
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rnx-kit/react-native-host",
3
- "version": "0.5.5",
3
+ "version": "0.5.7",
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",