From 7b763cd3dbf0c46dedd87f85529bfc6b04e58e87 Mon Sep 17 00:00:00 2001 From: Phillip Pan Date: Mon, 5 Jun 2023 19:48:29 -0700 Subject: [PATCH] clean up comments and imports in RCTHost header Summary: Changelog: [Internal] now that we've wrapped up the first iteration of the venice stable apis, let's clean up old comments and reorganize things to prepare this header for documentation. bypass-github-export-checks Reviewed By: mdvacca Differential Revision: D46334662 fbshipit-source-id: 68d6d2e41d7f7c5b1c69f3bb72482c418e771f72 --- .../bridgeless/platform/ios/Core/RCTHost.h | 31 +++++++------------ 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/packages/react-native/ReactCommon/react/bridgeless/platform/ios/Core/RCTHost.h b/packages/react-native/ReactCommon/react/bridgeless/platform/ios/Core/RCTHost.h index b5a3f18ca85..634106b3647 100644 --- a/packages/react-native/ReactCommon/react/bridgeless/platform/ios/Core/RCTHost.h +++ b/packages/react-native/ReactCommon/react/bridgeless/platform/ios/Core/RCTHost.h @@ -10,7 +10,6 @@ #import #import #import -#import #import #import "RCTInstance.h" @@ -21,11 +20,10 @@ NS_ASSUME_NONNULL_BEGIN @class RCTHost; @class RCTJSThreadManager; @class RCTModuleRegistry; -@protocol RCTInstanceDelegate; FB_RUNTIME_PROTOCOL @protocol RCTTurboModuleManagerDelegate; -typedef std::shared_ptr (^RCTHostJSEngineProvider)(void); +// Runtime API @protocol RCTHostDelegate @@ -34,15 +32,13 @@ typedef std::shared_ptr (^RCTHostJSEngineProv message:(NSString *)message exceptionId:(NSUInteger)exceptionId isFatal:(BOOL)isFatal; + - (void)hostDidStart:(RCTHost *)host; @end -/** - * RCTHost is an object which is responsible for managing the lifecycle of a single RCTInstance. - * RCTHost is long lived, while an instance may be deallocated and re-initialized. Some examples of when this happens: - * CMD+R reload in DEV or a JS crash. The host should be the single owner of an RCTInstance. - */ +typedef std::shared_ptr (^RCTHostJSEngineProvider)(void); + @interface RCTHost : NSObject - (instancetype)initWithBundleURL:(NSURL *)bundleURL @@ -50,13 +46,12 @@ typedef std::shared_ptr (^RCTHostJSEngineProv turboModuleManagerDelegate:(id)turboModuleManagerDelegate jsEngineProvider:(RCTHostJSEngineProvider)jsEngineProvider NS_DESIGNATED_INITIALIZER FB_OBJC_DIRECT; -/** - * This function initializes an RCTInstance if one does not yet exist. This function is currently only called on the - * main thread, but it should be threadsafe. - * TODO T74233481 - Verify if this function is threadsafe. - */ - (void)start; +- (void)callFunctionOnJSModule:(NSString *)moduleName method:(NSString *)method args:(NSArray *)args; + +// Renderer API + - (RCTFabricSurface *)createSurfaceWithModuleName:(NSString *)moduleName mode:(facebook::react::DisplayMode)displayMode initialProperties:(NSDictionary *)properties FB_OBJC_DIRECT; @@ -64,15 +59,11 @@ typedef std::shared_ptr (^RCTHostJSEngineProv - (RCTFabricSurface *)createSurfaceWithModuleName:(NSString *)moduleName initialProperties:(NSDictionary *)properties FB_OBJC_DIRECT; -- (RCTModuleRegistry *)getModuleRegistry FB_OBJC_DIRECT; - - (RCTSurfacePresenter *)getSurfacePresenter FB_OBJC_DIRECT; -/** - * Calls a method on a JS module that has been registered with `registerCallableModule`. Used to invoke a JS function - * from platform code. - */ -- (void)callFunctionOnJSModule:(NSString *)moduleName method:(NSString *)method args:(NSArray *)args; +// Native module API + +- (RCTModuleRegistry *)getModuleRegistry FB_OBJC_DIRECT; @end