Skip to content

Commit

Permalink
iOS: ignore extra modules during bridge start up if it's marked for T…
Browse files Browse the repository at this point in the history
…urboModule

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
  • Loading branch information
fkgozali authored and facebook-github-bot committed Dec 11, 2018
1 parent 33fb70f commit 2918679
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions React/CxxBridge/RCTCxxBridge.mm
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,16 @@ - (void)registerExtraModules
}
}

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;
Expand Down

0 comments on commit 2918679

Please sign in to comment.