introduce RCTHostCreationHelpers (#37328)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37328

Changelog: [Internal]
in this diff, i introduced a C function to be used to create RCTHost that obfuscates away all the C++ arguments. i expect this to be the API that the vast majority of the community will use to create `RCTHost`.

Reviewed By: cipolleschi

Differential Revision: D45678970

fbshipit-source-id: e3479db1bb68d93b3ee2f02598413d2080bb5ea9
This commit is contained in:
Phillip Pan
2023-05-11 21:45:50 -07:00
committed by Facebook GitHub Bot
parent 2599cc6b1f
commit a320dce2fd
2 changed files with 48 additions and 0 deletions
@@ -0,0 +1,29 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import <React/RCTDefines.h>
#import <UIKit/UIKit.h>
#import "RCTHost.h"
@class RCTHost;
@protocol RCTHostDelegate;
@protocol RCTTurboModuleManagerDelegate;
NS_ASSUME_NONNULL_BEGIN
RCT_EXTERN_C_BEGIN
RCTHost *RCTHostCreateDefault(
id<RCTHostDelegate> hostDelegate,
id<RCTTurboModuleManagerDelegate> turboModuleManagerDelegate,
RCTHostJSEngineProvider jsEngineProvider);
RCT_EXTERN_C_END
NS_ASSUME_NONNULL_END
@@ -0,0 +1,19 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import "RCTHostCreationHelpers.h"
RCTHost *RCTHostCreateDefault(
id<RCTHostDelegate> hostDelegate,
id<RCTTurboModuleManagerDelegate> turboModuleManagerDelegate,
RCTHostJSEngineProvider jsEngineProvider)
{
return [[RCTHost alloc] initWithHostDelegate:hostDelegate
turboModuleManagerDelegate:turboModuleManagerDelegate
bindingsInstallFunc:nullptr
jsEngineProvider:jsEngineProvider];
}