@@ -305,7 +305,7 @@ - (void)start
305
305
306
306
[self registerExtraModules ];
307
307
// Initialize all native modules that cannot be loaded lazily
308
- [self _initModules :RCTGetModuleClasses () withDispatchGroup: prepareBridge lazilyDiscovered: NO ];
308
+ ( void ) [self _initializeModules :RCTGetModuleClasses () withDispatchGroup: prepareBridge lazilyDiscovered: NO ];
309
309
310
310
[_performanceLogger markStopForTag: RCTPLNativeModuleInit];
311
311
@@ -635,9 +635,9 @@ - (void)installExtraJSBinding
635
635
}
636
636
}
637
637
638
- - (void ) _initModules : (NSArray <id<RCTBridgeModule>> *)modules
639
- withDispatchGroup : (dispatch_group_t )dispatchGroup
640
- lazilyDiscovered : (BOOL )lazilyDiscovered
638
+ - (NSArray <RCTModuleData *> *) _initializeModules : (NSArray <id<RCTBridgeModule>> *)modules
639
+ withDispatchGroup : (dispatch_group_t )dispatchGroup
640
+ lazilyDiscovered : (BOOL )lazilyDiscovered
641
641
{
642
642
RCTAssert (!(RCTIsMainQueue () && lazilyDiscovered), @" Lazy discovery can only happen off the Main Queue" );
643
643
@@ -688,11 +688,15 @@ - (void)_initModules:(NSArray<id<RCTBridgeModule>> *)modules
688
688
RCTProfileHookModules (self);
689
689
}
690
690
#endif
691
+ return moduleDataById;
691
692
}
692
693
693
694
- (void )registerAdditionalModuleClasses : (NSArray <Class> *)modules
694
695
{
695
- [self _initModules: modules withDispatchGroup: NULL lazilyDiscovered: YES ];
696
+ NSArray <RCTModuleData *> *newModules = [self _initializeModules: modules withDispatchGroup: NULL lazilyDiscovered: YES ];
697
+ if (_reactInstance) {
698
+ _reactInstance->getModuleRegistry ().registerModules (createNativeModules (newModules, self, _reactInstance));
699
+ }
696
700
}
697
701
698
702
- (void )_prepareModulesWithDispatchGroup : (dispatch_group_t )dispatchGroup
0 commit comments