@rnx-kit/react-native-host 0.5.1 → 0.5.2

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.
@@ -49,10 +49,36 @@ using SharedJSRuntimeFactory = std::shared_ptr<facebook::react::JSRuntimeFactory
49
49
  @end
50
50
 
51
51
  #ifdef USE_FEATURE_FLAGS
52
+ #if __has_include(<React-RCTAppDelegate/RCTArchConfiguratorProtocol.h>) || __has_include(<React_RCTAppDelegate/RCTArchConfiguratorProtocol.h>)
53
+ #define USE_UNIFIED_FEATURE_FLAGS 1
54
+ #endif // __has_include(<React-RCTAppDelegate/RCTArchConfiguratorProtocol.h>)
55
+
52
56
  // https://github.com/facebook/react-native/blob/0.74-stable/packages/react-native/Libraries/AppDelegate/RCTAppDelegate.mm#L272-L286
53
57
  class RNXBridgelessFeatureFlags : public facebook::react::ReactNativeFeatureFlagsDefaults
54
58
  {
55
59
  public:
60
+ #ifdef USE_UNIFIED_FEATURE_FLAGS // >= 0.77
61
+ bool enableBridgelessArchitecture() override
62
+ {
63
+ return true;
64
+ }
65
+ bool enableFabricRenderer() override
66
+ {
67
+ return true;
68
+ }
69
+ bool useTurboModules() override
70
+ {
71
+ return true;
72
+ }
73
+ bool useNativeViewConfigsInBridgelessMode() override
74
+ {
75
+ return true;
76
+ }
77
+ bool enableFixForViewCommandRace() override
78
+ {
79
+ return true;
80
+ }
81
+ #else // < 0.77
56
82
  bool useModernRuntimeScheduler() override
57
83
  {
58
84
  return true;
@@ -67,6 +93,7 @@ public:
67
93
  {
68
94
  return true;
69
95
  }
96
+ #endif // USE_UNIFIED_FEATURE_FLAGS
70
97
  };
71
98
  #endif // USE_FEATURE_FLAGS
72
99
 
@@ -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
- RCTSurfaceSizeMeasureMode sizeMeasureMode =
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
@@ -248,7 +248,9 @@ using ReactNativeConfig = facebook::react::EmptyReactNativeConfig const;
248
248
  }
249
249
 
250
250
  #if USE_BRIDGELESS
251
+ #ifndef USE_UNIFIED_FEATURE_FLAGS
251
252
  RCTSetUseNativeViewConfigsInBridgelessMode(YES);
253
+ #endif
252
254
  RCTEnableTurboModuleInterop(YES);
253
255
  RCTEnableTurboModuleInteropBridgeProxy(YES);
254
256
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rnx-kit/react-native-host",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
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",