@rnx-kit/react-native-host 0.5.3 → 0.5.4

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.
@@ -21,6 +21,12 @@
21
21
  #define USE_FEATURE_FLAGS
22
22
  #endif // __has_include(<react/featureflags/ReactNativeFeatureFlags.h>)
23
23
 
24
+ #if __has_include(<ReactCodegen/RCTThirdPartyComponentsProvider.h>)
25
+ #define USE_CODEGEN_PROVIDER 1
26
+ #import <ReactCodegen/RCTThirdPartyComponentsProvider.h>
27
+ #import <React/RCTComponentViewFactory.h>
28
+ #endif // __has_include(<ReactCodegen/RCTThirdPartyComponentsProvider.h>)
29
+
24
30
  #if __has_include(<react/runtime/JSEngineInstance.h>)
25
31
  using SharedJSRuntimeFactory = std::shared_ptr<facebook::react::JSEngineInstance>;
26
32
  #else
@@ -1,6 +1,8 @@
1
1
  #import "ReactNativeHost.h"
2
2
 
3
+ // clang-format off
3
4
  #include "FollyConfig.h"
5
+ // clang-format on
4
6
 
5
7
  #import <React/RCTBridge.h>
6
8
  #import <React/RCTBundleURLProvider.h>
@@ -27,6 +29,11 @@ using ReactNativeConfig = facebook::react::EmptyReactNativeConfig const;
27
29
  #endif // USE_BRIDGELESS
28
30
  @end
29
31
 
32
+ #ifdef USE_CODEGEN_PROVIDER
33
+ @interface ReactNativeHost () <RCTComponentViewFactoryComponentProvider>
34
+ @end
35
+ #endif // USE_CODEGEN_PROVIDER
36
+
30
37
  @implementation ReactNativeHost {
31
38
  __weak id<RNXHostConfig> _config;
32
39
  NSDictionary *_launchOptions;
@@ -59,6 +66,11 @@ using ReactNativeConfig = facebook::react::EmptyReactNativeConfig const;
59
66
  _hostReleaser = [[RNXHostReleaser alloc] initWithHost:self];
60
67
  }
61
68
 
69
+ #ifdef USE_CODEGEN_PROVIDER
70
+ [RCTComponentViewFactory currentComponentViewFactory].thirdPartyFabricComponentsProvider =
71
+ self;
72
+ #endif // USE_CODEGEN_PROVIDER
73
+
62
74
  #ifdef USE_FEATURE_FLAGS
63
75
  if (self.isBridgelessEnabled) {
64
76
  facebook::react::ReactNativeFeatureFlags::override(
@@ -224,6 +236,15 @@ using ReactNativeConfig = facebook::react::EmptyReactNativeConfig const;
224
236
 
225
237
  #endif // USE_BRIDGELESS
226
238
 
239
+ // MARK: - RCTComponentViewFactoryComponentProvider details
240
+
241
+ #ifdef USE_CODEGEN_PROVIDER
242
+ - (NSDictionary<NSString *, Class<RCTComponentViewProtocol>> *)thirdPartyFabricComponents
243
+ {
244
+ return [RCTThirdPartyComponentsProvider thirdPartyFabricComponents];
245
+ }
246
+ #endif // USE_CODEGEN_PROVIDER
247
+
227
248
  // MARK: - Private
228
249
 
229
250
  - (BOOL)isBridgelessEnabled
@@ -274,7 +295,7 @@ using ReactNativeConfig = facebook::react::EmptyReactNativeConfig const;
274
295
  #else
275
296
  return std::make_shared<facebook::react::RCTHermesInstance>(nullptr, false);
276
297
  #endif // USE_REACT_NATIVE_CONFIG
277
- #else // USE_HERMES
298
+ #else // USE_HERMES
278
299
  return std::make_shared<facebook::react::RCTJscInstance>();
279
300
  #endif // USE_HERMES
280
301
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rnx-kit/react-native-host",
3
- "version": "0.5.3",
3
+ "version": "0.5.4",
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",