diff --git a/React/CoreModules/RCTDevSettings.mm b/React/CoreModules/RCTDevSettings.mm index 08615d6131a..8cb40a963a8 100644 --- a/React/CoreModules/RCTDevSettings.mm +++ b/React/CoreModules/RCTDevSettings.mm @@ -113,7 +113,7 @@ void RCTDevSettingsSetEnabled(BOOL enabled) { @end -@interface RCTDevSettings () { +@interface RCTDevSettings () { BOOL _isJSLoaded; #if ENABLE_PACKAGER_CONNECTION RCTHandlerToken _reloadToken; @@ -129,14 +129,9 @@ void RCTDevSettingsSetEnabled(BOOL enabled) { RCT_EXPORT_MODULE() -+ (BOOL)requiresMainQueueSetup -{ - return YES; // RCT_DEV-only -} - - (instancetype)init { - // default behavior is to use NSUserDefaults + // Default behavior is to use NSUserDefaults with shake and hot loading enabled. NSDictionary *defaultValues = @{ kRCTDevSettingShakeToShowDevMenu : @YES, kRCTDevSettingHotLoadingEnabled : @YES, @@ -177,11 +172,9 @@ RCT_EXPORT_MODULE() #endif #if RCT_ENABLE_INSPECTOR - // we need this dispatch back to the main thread because even though this - // is executed on the main thread, at this point the bridge is not yet - // finished with its initialisation. But it does finish by the time it - // relinquishes control of the main thread, so only queue on the JS thread - // after the current main thread operation is done. + // We need this dispatch to the main thread because the bridge is not yet + // finished with its initialisation. By the time it relinquishes control of + // the main thread, this operation can be performed. dispatch_async(dispatch_get_main_queue(), ^{ [bridge dispatchBlock:^{ @@ -439,10 +432,18 @@ RCT_EXPORT_METHOD(addMenuItem:(NSString *)title) }); } +- (std::shared_ptr)getTurboModuleWithJsInvoker:(std::shared_ptr)jsInvoker +{ + return std::make_shared(self, jsInvoker); +} + @end #else // #if RCT_DEV +@interface RCTDevSettings () +@end + @implementation RCTDevSettings - (instancetype)initWithDataSource:(id)dataSource @@ -489,6 +490,11 @@ RCT_EXPORT_METHOD(addMenuItem:(NSString *)title) { } +- (std::shared_ptr)getTurboModuleWithJsInvoker:(std::shared_ptr)jsInvoker +{ + return std::make_shared(self, jsInvoker); +} + @end #endif