@rnx-kit/react-native-host 0.4.8 → 0.4.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.
@@ -1,11 +1,17 @@
1
1
  #import "ReactNativeHost.h"
2
2
 
3
+ @class RCTHost;
3
4
  @class RCTSurfacePresenter;
4
5
 
5
6
  NS_ASSUME_NONNULL_BEGIN
6
7
 
7
8
  @interface ReactNativeHost (Private)
8
9
 
10
+ /// Returns the current ``RCTHost`` instance.
11
+ ///
12
+ /// - Note: Returns `nil` if New Architecture is not enabled.
13
+ @property (nonatomic, readonly, nullable) RCTHost *reactHost;
14
+
9
15
  /// Returns the current ``RCTSurfacePresenter`` instance.
10
16
  ///
11
17
  /// - Note: Returns `nil` if New Architecture is not enabled.
@@ -7,8 +7,11 @@
7
7
  #import <React/RCTFabricSurface.h>
8
8
  #import <React/RCTSurfaceHostingProxyRootView.h>
9
9
  #endif // __has_include(<React/RCTFabricSurfaceHostingProxyRootView.h>)
10
+ #ifdef USE_BRIDGELESS
11
+ #import <ReactCommon/RCTHost.h>
12
+ #endif // USE_BRIDGELESS
10
13
  static NSString *const kReactConcurrentRoot = @"concurrentRoot";
11
- #else
14
+ #else // USE_FABRIC
12
15
  #import <React/RCTRootView.h>
13
16
  #endif // USE_FABRIC
14
17
 
@@ -53,6 +56,13 @@ static NSString *const kReactConcurrentRoot = @"concurrentRoot";
53
56
  return [[RCTFabricSurfaceHostingProxyRootView alloc] initWithBridge:self.bridge
54
57
  moduleName:moduleName
55
58
  initialProperties:initialProps];
59
+ #elif USE_BRIDGELESS
60
+ RCTFabricSurface *surface = [self.reactHost createSurfaceWithModuleName:moduleName
61
+ initialProperties:initialProps];
62
+ RCTSurfaceSizeMeasureMode sizeMeasureMode =
63
+ RCTSurfaceSizeMeasureModeWidthExact | RCTSurfaceSizeMeasureModeHeightExact;
64
+ return [[RCTSurfaceHostingProxyRootView alloc] initWithSurface:surface
65
+ sizeMeasureMode:sizeMeasureMode];
56
66
  #else
57
67
  RCTFabricSurface *surface =
58
68
  [[RCTFabricSurface alloc] initWithSurfacePresenter:self.surfacePresenter
@@ -108,6 +108,11 @@ using ReactNativeConfig = facebook::react::EmptyReactNativeConfig const;
108
108
  }
109
109
  }
110
110
 
111
+ - (RCTHost *)reactHost
112
+ {
113
+ return _reactHost;
114
+ }
115
+
111
116
  - (RCTSurfacePresenter *)surfacePresenter
112
117
  {
113
118
  #if USE_BRIDGELESS
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rnx-kit/react-native-host",
3
- "version": "0.4.8",
3
+ "version": "0.4.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",