Skip to content

Commit

Permalink
[dev-launcher] Fix launcher bridge not filtering modules (#26332)
Browse files Browse the repository at this point in the history
# Why

Closes ENG-11046
Closes #26298

# How

Overwrite `EXDevLauncherBridgeDelegate` `createBridgeWithDelegate`
method to ensure we use `EXDevLauncherRCTBridge` instead of the standard
`RCTBridge` for the launcher, preventing native modules like RealmJS
from getting wrongly initialized.


# Test Plan

Temporarily added `realm` to bare-expo and fabric-tester 

# Checklist


- [ ] Documentation is up to date to reflect these changes (eg:
https://docs.expo.dev and README.md).
- [ ] Conforms with the [Documentation Writing Style
Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
- [ ] This diff will work correctly for `npx expo prebuild` & EAS Build
(eg: updated a module plugin).
  • Loading branch information
gabrieldonadel committed Jan 9, 2024
1 parent 28028a7 commit 54108e2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions packages/expo-dev-launcher/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

### 🐛 Bug fixes

- Fix launcher bridge not filtering native modules. ([#26332](https://github.com/expo/expo/pull/26332) by [@gabrieldonadel](https://github.com/gabrieldonadel))

### 💡 Others

- Remove classic updates. ([#26036](https://github.com/expo/expo/pull/26036), [#26230](https://github.com/expo/expo/pull/26230) by [@wschurman](https://github.com/wschurman))
Expand Down
5 changes: 5 additions & 0 deletions packages/expo-dev-launcher/ios/EXDevLauncherBridgeDelegate.mm
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#import <EXDevLauncher/EXDevLauncherBridgeDelegate.h>
#import <EXDevLauncher/EXDevLauncherController.h>
#import <EXDevLauncher/EXDevLauncherRCTBridge.h>

#import <React/RCTBundleURLProvider.h>
#if __has_include(<React_RCTAppDelegate/RCTAppSetupUtils.h>)
Expand All @@ -21,6 +22,10 @@ - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge {
return [[EXDevLauncherController sharedInstance] sourceURLForBridge:bridge];
}

- (RCTBridge *)createBridgeWithDelegate:(id<RCTBridgeDelegate>)delegate launchOptions:(NSDictionary *)launchOptions {
return [[EXDevLauncherRCTBridge alloc] initWithDelegate:delegate launchOptions:launchOptions];
}

- (RCTRootView *)createRootViewWithModuleName:(NSString *)moduleName launchOptions:(NSDictionary * _Nullable)launchOptions application:(UIApplication *)application{
BOOL enableTM = NO;
#if RCT_NEW_ARCH_ENABLED
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ - (RCTDevMenu *)devMenu
@"ExpoBridgeModule",
@"EXNativeModulesProxy",
@"ViewManagerAdapter_",
@"ExpoModulesCore"
@"ExpoModulesCore",
@"EXReactNativeEventEmitter"
];
NSArray<Class> *filteredModuleList = [modules filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(id _Nullable clazz, NSDictionary<NSString *,id> * _Nullable bindings) {
Expand Down

0 comments on commit 54108e2

Please sign in to comment.