Skip to content

Commit

Permalink
introduce RCTHostCreationHelpers (#37328)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #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
  • Loading branch information
philIip authored and facebook-github-bot committed May 12, 2023
1 parent 2599cc6 commit a320dce
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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];
}

0 comments on commit a320dce

Please sign in to comment.