11#import " ReactNativeHost.h"
22
3+ // clang-format off
34#include " FollyConfig.h"
5+ // clang-format on
46
57#import < React/RCTBridge.h>
68#import < React/RCTBundleURLProvider.h>
@@ -27,6 +29,11 @@ @interface ReactNativeHost () <RCTCxxBridgeDelegate>
2729#endif // USE_BRIDGELESS
2830@end
2931
32+ #ifdef USE_CODEGEN_PROVIDER
33+ @interface ReactNativeHost () <RCTComponentViewFactoryComponentProvider>
34+ @end
35+ #endif // USE_CODEGEN_PROVIDER
36+
3037@implementation ReactNativeHost {
3138 __weak id <RNXHostConfig> _config;
3239 NSDictionary *_launchOptions;
@@ -59,6 +66,11 @@ - (instancetype)initWithConfig:(id<RNXHostConfig>)config launchOptions:(NSDictio
5966 _hostReleaser = [[RNXHostReleaser alloc ] initWithHost: self ];
6067 }
6168
69+ #ifdef USE_CODEGEN_PROVIDER
70+ [RCTComponentViewFactory currentComponentViewFactory ].thirdPartyFabricComponentsProvider =
71+ self;
72+ #endif // USE_CODEGEN_PROVIDER
73+
6274#ifdef USE_FEATURE_FLAGS
6375 if (self.isBridgelessEnabled ) {
6476 facebook::react::ReactNativeFeatureFlags::override (
@@ -224,6 +236,15 @@ - (void)didCreateContextContainer:
224236
225237#endif // USE_BRIDGELESS
226238
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+
227248// MARK: - Private
228249
229250- (BOOL )isBridgelessEnabled
@@ -274,7 +295,7 @@ - (void)initializeReactHost
274295#else
275296 return std::make_shared<facebook::react::RCTHermesInstance>(nullptr , false );
276297#endif // USE_REACT_NATIVE_CONFIG
277- #else // USE_HERMES
298+ #else // USE_HERMES
278299 return std::make_shared<facebook::react::RCTJscInstance>();
279300#endif // USE_HERMES
280301 };
0 commit comments