From fcda37f6e933cb18416099e62ddfda823c0ee17b Mon Sep 17 00:00:00 2001 From: Phillip Pan Date: Thu, 2 Nov 2023 17:21:13 -0700 Subject: [PATCH] remove warning to tell user to set requiresMainQueueSetup (#41294) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/41294 Changelog: [Internal] i believe this warning is outdated, i don't think having a custom initializer or exporting constants means that your module needs to be setup on main. Reviewed By: cipolleschi Differential Revision: D50919152 fbshipit-source-id: dc91af5fc88eca4f07a5f35adb888160b978cc38 --- packages/react-native/React/Base/RCTModuleData.mm | 14 -------------- .../ios/ReactCommon/RCTTurboModuleManager.mm | 14 +------------- 2 files changed, 1 insertion(+), 27 deletions(-) diff --git a/packages/react-native/React/Base/RCTModuleData.mm b/packages/react-native/React/Base/RCTModuleData.mm index dbbc6daa9aa..1be7a2af25e 100644 --- a/packages/react-native/React/Base/RCTModuleData.mm +++ b/packages/react-native/React/Base/RCTModuleData.mm @@ -77,20 +77,6 @@ int32_t getUniqueId() !_instance && [_moduleClass instanceMethodForSelector:@selector(init)] != objectInitMethod; _requiresMainQueueSetup = _hasConstantsToExport || hasCustomInit; - if (_requiresMainQueueSetup) { - const char *methodName = ""; - if (_hasConstantsToExport) { - methodName = "constantsToExport"; - } else if (hasCustomInit) { - methodName = "init"; - } - RCTLogWarn( - @"Module %@ requires main queue setup since it overrides `%s` but doesn't implement " - "`requiresMainQueueSetup`. In a future release React Native will default to initializing all native modules " - "on a background thread unless explicitly opted-out of.", - _moduleClass, - methodName); - } } } diff --git a/packages/react-native/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModuleManager.mm b/packages/react-native/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModuleManager.mm index ad8fadd04b1..e01659a871f 100644 --- a/packages/react-native/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModuleManager.mm +++ b/packages/react-native/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModuleManager.mm @@ -879,19 +879,7 @@ static Class getFallbackClassFromName(const char *name) */ const BOOL hasCustomInit = [moduleClass instanceMethodForSelector:@selector(init)] != objectInitMethod; - BOOL requiresMainQueueSetup = hasConstantsToExport || hasCustomInit; - if (requiresMainQueueSetup) { - RCTLogWarn( - @"Module %@ requires main queue setup since it overrides `%s` but doesn't implement " - "`requiresMainQueueSetup`. In a future release React Native will default to initializing all NativeModules " - "on a background thread unless explicitly opted-out of.", - moduleClass, - hasConstantsToExport ? "constantsToExport" - : hasCustomInit ? "init" - : ""); - } - - return requiresMainQueueSetup; + return hasConstantsToExport || hasCustomInit; } - (void)installJSBindings:(facebook::jsi::Runtime &)runtime