mirror of
https://github.com/status-im/react-native.git
synced 2025-01-14 03:26:07 +00:00
Update ModuleRegistry if there're new modules registered
Reviewed By: fkgozali Differential Revision: D7638394 fbshipit-source-id: c1690da7977f0335bc661df5f19dc9f473150d41
This commit is contained in:
parent
d2a1461d26
commit
b5f90ed497
@ -305,7 +305,7 @@ struct RCTInstanceCallback : public InstanceCallback {
|
||||
|
||||
[self registerExtraModules];
|
||||
// Initialize all native modules that cannot be loaded lazily
|
||||
[self _initModules:RCTGetModuleClasses() withDispatchGroup:prepareBridge lazilyDiscovered:NO];
|
||||
(void)[self _initializeModules:RCTGetModuleClasses() withDispatchGroup:prepareBridge lazilyDiscovered:NO];
|
||||
|
||||
[_performanceLogger markStopForTag:RCTPLNativeModuleInit];
|
||||
|
||||
@ -635,9 +635,9 @@ struct RCTInstanceCallback : public InstanceCallback {
|
||||
}
|
||||
}
|
||||
|
||||
- (void)_initModules:(NSArray<id<RCTBridgeModule>> *)modules
|
||||
withDispatchGroup:(dispatch_group_t)dispatchGroup
|
||||
lazilyDiscovered:(BOOL)lazilyDiscovered
|
||||
- (NSArray<RCTModuleData *> *)_initializeModules:(NSArray<id<RCTBridgeModule>> *)modules
|
||||
withDispatchGroup:(dispatch_group_t)dispatchGroup
|
||||
lazilyDiscovered:(BOOL)lazilyDiscovered
|
||||
{
|
||||
RCTAssert(!(RCTIsMainQueue() && lazilyDiscovered), @"Lazy discovery can only happen off the Main Queue");
|
||||
|
||||
@ -688,11 +688,15 @@ struct RCTInstanceCallback : public InstanceCallback {
|
||||
RCTProfileHookModules(self);
|
||||
}
|
||||
#endif
|
||||
return moduleDataById;
|
||||
}
|
||||
|
||||
- (void)registerAdditionalModuleClasses:(NSArray<Class> *)modules
|
||||
{
|
||||
[self _initModules:modules withDispatchGroup:NULL lazilyDiscovered:YES];
|
||||
NSArray<RCTModuleData *> *newModules = [self _initializeModules:modules withDispatchGroup:NULL lazilyDiscovered:YES];
|
||||
if (_reactInstance) {
|
||||
_reactInstance->getModuleRegistry().registerModules(createNativeModules(newModules, self, _reactInstance));
|
||||
}
|
||||
}
|
||||
|
||||
- (void)_prepareModulesWithDispatchGroup:(dispatch_group_t)dispatchGroup
|
||||
|
Loading…
x
Reference in New Issue
Block a user