Skip to content

Commit

Permalink
remove warning to tell user to set requiresMainQueueSetup (facebook#4…
Browse files Browse the repository at this point in the history
…1294)

Summary:
Pull Request resolved: facebook#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
  • Loading branch information
philIip authored and pull[bot] committed Feb 22, 2024
1 parent f7bac14 commit ea04463
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 27 deletions.
14 changes: 0 additions & 14 deletions packages/react-native/React/Base/RCTModuleData.mm
Original file line number Diff line number Diff line change
Expand Up @@ -77,20 +77,6 @@ - (void)setUp
!_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);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -879,19 +879,7 @@ - (BOOL)_requiresMainQueueSetup:(Class)moduleClass
*/
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
Expand Down

0 comments on commit ea04463

Please sign in to comment.