From aa1ad5496cdc0323de6e2b083a7e3e1826ef8289 Mon Sep 17 00:00:00 2001 From: Ramanpreet Nara Date: Tue, 26 Sep 2023 14:51:02 -0700 Subject: [PATCH] Enable TurboModule interop in Bridgeless Mode (#39687) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/39687 Bridgeless mode is releasing in 0.73. Bridgeless mode isn't stable inside RNTester (in 0.73) without the TurboModule interop layer: T164853040. **Changes:** Enable the TurboModule interop layer in RNTester (Bridgeless Mode). **Urgency:** This will unblock the 0.73. Changelog: [General][Added] - Enable TurboModule interop in Bridgeless mode Reviewed By: fkgozali, dmytrorykun, luluwu2032 Differential Revision: D49653919 fbshipit-source-id: a4a09a99544c2ef8713484dbeab5cb04f29256cc --- .../react-native/Libraries/AppDelegate/RCTAppDelegate.mm | 5 +++++ .../react/defaults/DefaultNewArchitectureEntryPoint.kt | 1 + 2 files changed, 6 insertions(+) diff --git a/packages/react-native/Libraries/AppDelegate/RCTAppDelegate.mm b/packages/react-native/Libraries/AppDelegate/RCTAppDelegate.mm index 6e8e018b254c1a..d666fe31c1005d 100644 --- a/packages/react-native/Libraries/AppDelegate/RCTAppDelegate.mm +++ b/packages/react-native/Libraries/AppDelegate/RCTAppDelegate.mm @@ -89,6 +89,11 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( #if RCT_NEW_ARCH_ENABLED // Enable native view config interop only if both bridgeless mode and Fabric is enabled. RCTSetUseNativeViewConfigsInBridgelessMode([self fabricEnabled]); + + // Enable TurboModule interop by default in Bridgeless mode + RCTEnableTurboModuleInterop(YES); + RCTEnableTurboModuleInteropBridgeProxy(YES); + [self createReactHost]; [self unstable_registerLegacyComponents]; [RCTComponentViewFactory currentComponentViewFactory].thirdPartyFabricComponentsProvider = self; diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultNewArchitectureEntryPoint.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultNewArchitectureEntryPoint.kt index c0d5e90e41b47f..fa6ff875dda211 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultNewArchitectureEntryPoint.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultNewArchitectureEntryPoint.kt @@ -35,6 +35,7 @@ object DefaultNewArchitectureEntryPoint { ReactFeatureFlags.unstable_useFabricInterop = fabricEnabled ReactFeatureFlags.enableBridgelessArchitecture = bridgelessEnabled ReactFeatureFlags.useNativeViewConfigsInBridgelessMode = fabricEnabled && bridgelessEnabled + ReactFeatureFlags.unstable_useTurboModuleInterop = bridgelessEnabled this.privateFabricEnabled = fabricEnabled this.privateTurboModulesEnabled = turboModulesEnabled