Skip to content

Commit 97adbd8

Browse files
Bruno Aybarreact-native-bot
authored andcommitted
Fix issue with extraModulesForBridge callback (facebook#49849)
Summary: Fixes facebook#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: facebook#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 68dc582 commit 97adbd8

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

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

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

159+
- (NSArray<id<RCTBridgeModule>> *)extraModulesForBridge:(RCTBridge *)bridge
160+
{
161+
if ([_delegate respondsToSelector:@selector(extraModulesForBridge:)]) {
162+
return [_delegate extraModulesForBridge:bridge];
163+
}
164+
165+
return @[];
166+
}
167+
159168
#pragma mark - RCTComponentViewFactoryComponentProvider
160169

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

0 commit comments

Comments
 (0)