Skip to content

Commit bcc8b27

Browse files
Bruno Aybarreact-native-bot
authored andcommitted
Fix issue with extraModulesForBridge callback (#49849)
Summary: Fixes #49819 . Details about how the issue was introduced in the issue description. bypass-github-export-checks ## Changelog: [IOS] [FIXED] - Fixed: extraModulesForBridge callback not called when New Architecture enabled <!-- Help reviewers and the release process by writing your own changelog entry. Pick one each for the category and type tags: [ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message For more details, see: https://reactnative.dev/contributing/changelogs-in-pull-requests Pull Request resolved: #49849 Test Plan: Without the change: 1. Open `packages/rn-tester` project 2. In `AppDelegate.mm`, implement `extraModulesForBridge` and add a breakpoint / output something 3. Run the app in iOS <-- Verify that the method is not executed With the change: 1-3. Same as above <-- verify that the method is called correctly > [!NOTE] > As far as I could tell, there is no test suite for this specific codepath, so I didn't write a test for this change. Happy to write one if someone can guide me a little bit. Reviewed By: rshest Differential Revision: D70724196 Pulled By: cipolleschi fbshipit-source-id: cc08798d08cdbd6883347810c7d2697c358770fb
1 parent 2f4dbc6 commit bcc8b27

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

packages/react-native/Libraries/AppDelegate/RCTReactNativeFactory.mm

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,15 @@ - (Class)getModuleClassFromName:(const char *)name
193193
return RCTAppSetupDefaultModuleFromClass(moduleClass, self.delegate.dependencyProvider);
194194
}
195195

196+
- (NSArray<id<RCTBridgeModule>> *)extraModulesForBridge:(RCTBridge *)bridge
197+
{
198+
if ([_delegate respondsToSelector:@selector(extraModulesForBridge:)]) {
199+
return [_delegate extraModulesForBridge:bridge];
200+
}
201+
202+
return @[];
203+
}
204+
196205
#pragma mark - RCTComponentViewFactoryComponentProvider
197206

198207
- (NSDictionary<NSString *, Class<RCTComponentViewProtocol>> *)thirdPartyFabricComponents

0 commit comments

Comments
 (0)