You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 3278f30
Browse filesBrowse the repository at this point in the historyBrowse files
Summary:
Pull Request resolved: #56984
Wraps all legacy TurboModule interop code paths in `#ifndef RCT_REMOVE_LEGACY_MODULE_INTEROP` so that apps which opt into the `react-remove-legacy-module-interop` buck constraint (added in the parent diff D106830763) compile them out entirely. This enables dead-code elimination of the legacy `RCTBridgeModule` interop surface in both iOS and Android, leaving only the pure TurboModule path.
Changes:
iOS (Objective-C / C++):
- `Libraries/AppDelegate/RCTRootViewFactory.mm`: Skip `RCTEnableTurboModuleInterop(YES)` when the flag is defined and always call `RCTEnableTurboModuleInteropBridgeProxy(YES)`.
- `React/Base/RCTBridge.{h,mm}`: Hide `RCTTurboModuleInteropEnabled` / `RCTEnableTurboModuleInterop` API and the backing `turboModuleInteropEnabled` static when the flag is defined.
- `ReactCommon/.../ios/ReactCommon/RCTInteropTurboModule.{h,mm}`: Compile the entire RCTInteropTurboModule translation unit only when the flag is undefined.
- `ReactCommon/.../ios/ReactCommon/RCTTurboModuleManager.mm`: Gate `isTurboModuleInstance`, legacy module eager registration, `provideLegacyModule:`, legacy short-circuit in `_provideObjCModule:` / `_shouldCreateObjCModule:`, and the legacy branch of `installJSBindings` so that `TurboModuleBinding::install` is called with only the turbo module provider when the flag is defined.
Android (C++/JNI):
- `ReactAndroid/.../TurboModuleManager.{h,cpp}`: Gate `JMethodDescriptor`/`JavaTurboModule` helpers, `legacyModuleCache_`, `createLegacyModuleProvider`, and `getLegacyModule`. `installJSBindings` falls back to the two-argument `TurboModuleBinding::install` when the flag is defined.
- `ReactCommon/.../android/ReactCommon/JavaInteropTurboModule.{h,cpp}`: Compile the entire JavaInteropTurboModule translation unit only when the flag is undefined.
Default behavior is unchanged because `RCT_REMOVE_LEGACY_MODULE_INTEROP` is not defined unless the new constraint is selected.
## Changelog: [GENERAL][ADDED] Gate legacy TurboModule interop behind `RCT_REMOVE_LEGACY_MODULE_INTEROP`
Reviewed By: zeyap
Differential Revision: D106109160
fbshipit-source-id: c9e90b63957cd2f5822a6e975b363bc8869a112f
Copy file name to clipboardExpand all lines: packages/react-native/ReactCommon/react/nativemodule/core/platform/android/ReactCommon/JavaInteropTurboModule.cpp
Copy file name to clipboardExpand all lines: packages/react-native/ReactCommon/react/nativemodule/core/platform/android/ReactCommon/JavaInteropTurboModule.h
+4Lines changed: 4 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,8 @@
7
7
8
8
#pragma once
9
9
10
+
#ifndef RCT_REMOVE_LEGACY_MODULE_INTEROP
11
+
10
12
#include<string>
11
13
#include<vector>
12
14
@@ -46,3 +48,5 @@ class JSI_EXPORT JavaInteropTurboModule : public JavaTurboModule {
Copy file name to clipboardExpand all lines: packages/react-native/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTInteropTurboModule.h
+4Lines changed: 4 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,8 @@
7
7
8
8
#pragma once
9
9
10
+
#ifndef RCT_REMOVE_LEGACY_MODULE_INTEROP
11
+
10
12
#import<string>
11
13
#import<vector>
12
14
@@ -88,3 +90,5 @@ class JSI_EXPORT ObjCInteropTurboModule : public ObjCTurboModule {
Copy file name to clipboardExpand all lines: packages/react-native/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTInteropTurboModule.mm
+4Lines changed: 4 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,8 @@
7
7
8
8
#include"RCTInteropTurboModule.h"
9
9
10
+
#ifndef RCT_REMOVE_LEGACY_MODULE_INTEROP
11
+
10
12
#import<objc/message.h>
11
13
#import<objc/runtime.h>
12
14
@@ -694,3 +696,5 @@ T RCTConvertTo(SEL selector, id json)
Copy file name to clipboardExpand all lines: packages/react-native/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModuleManager.mm
0 commit comments