iOS: ignore extra modules during bridge start up if it's marked for TurboModule

Summary: Currently, bridge delegate can provide extra modules during bridge start up path. For TurboModules, we don't need this mechanism (if we need eager init, it will be done in a different way). So, let's ignore modules marked as RCTTurboModule if they are supplied as "extra native modules".

Reviewed By: axe-fb

Differential Revision: D13383710

fbshipit-source-id: c88d32739be9f66e0daf07ef5465ea6457f8d1c6
This commit is contained in:
Kevin Gozali 2018-12-10 23:58:24 -08:00 committed by Facebook Github Bot
parent 33fb70f6b6
commit 2918679479

View File

@ -659,6 +659,16 @@ struct RCTInstanceCallback : public InstanceCallback {
}
}
if (RCTTurboModuleEnabled() && [module conformsToProtocol:@protocol(RCTTurboModule)]) {
#if RCT_DEBUG
// TODO: don't ask for extra module for when TurboModule is enabled.
RCTLogError(@"NativeModule '%@' was marked as TurboModule, but provided as an extra NativeModule "
"by the class '%@', ignoring.",
moduleName, moduleClass);
#endif
continue;
}
// Instantiate moduleData container
RCTModuleData *moduleData = [[RCTModuleData alloc] initWithModuleInstance:module bridge:self];
_moduleDataByName[moduleName] = moduleData;