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
This commit is contained in:
Phillip Pan
2023-11-02 17:21:13 -07:00
committed by Facebook GitHub Bot
parent 1301da8e02
commit fcda37f6e9
2 changed files with 1 additions and 27 deletions
@@ -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);
}
}
}
@@ -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