From b13d489d849b5fdf53f913379baf82db12dd9e1b Mon Sep 17 00:00:00 2001 From: Christoph Purrer Date: Mon, 27 Jul 2026 09:32:49 -0700 Subject: [PATCH] Drop RCT_EXPORT_METHOD from RCTDevMenu TurboModule (#57681) Summary: Pull Request resolved: https://github.com/react/react-native/pull/57681 Changelog: [Internal] `RCTDevMenu` is a TurboModule: it conforms to `NativeDevMenuSpec` and implements `getTurboModule:` returning the codegen'd `...SpecJSI`. For TurboModules, the JS->ObjC dispatch is driven by codegen (the generated spec supplies the `selector` and argument kinds, invoked at runtime via `NSMethodSignature` / `NSInvocation`), not by the `RCT_EXPORT_METHOD` macro's `__rct_export__` metadata. The exported methods here are async-void with concrete parameter types (no generic `id` requiring `RCTConvert` coercion), so the macro is not functionally required. Convert them to plain ObjC method declarations; conformance to the codegen'd `NativeDevMenuSpec` protocol keeps compiler-enforced signature parity. Signature-only refactor with no change to the JS-facing API. Sync methods, methods with `id` params, and `constantsToExport` are intentionally left untouched. Reviewed By: cortinico Differential Revision: D113579872 fbshipit-source-id: 4f4f4803bc876e3558a5a33a935fcfc313c3c6e3 --- packages/react-native/React/CoreModules/RCTDevMenu.mm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/react-native/React/CoreModules/RCTDevMenu.mm b/packages/react-native/React/CoreModules/RCTDevMenu.mm index 890c1596df7..883b4ba7f8e 100644 --- a/packages/react-native/React/CoreModules/RCTDevMenu.mm +++ b/packages/react-native/React/CoreModules/RCTDevMenu.mm @@ -430,7 +430,7 @@ RCT_EXPORT_MODULE() return items; } -RCT_EXPORT_METHOD(show) +- (void)show { if ((_actionSheet != nullptr) || RCTRunningInAppExtension() || !_devMenuEnabled) { return; @@ -495,13 +495,13 @@ RCT_EXPORT_METHOD(show) return ((RCTDevSettings *)[_moduleRegistry moduleForName:"DevSettings"]).isShakeToShowDevMenuEnabled; } -RCT_EXPORT_METHOD(reload) +- (void)reload { WARN_DEPRECATED_DEV_MENU_EXPORT(); RCTTriggerReloadCommandListeners(@"Unknown from JS"); } -RCT_EXPORT_METHOD(setProfilingEnabled : (BOOL)enabled) +- (void)setProfilingEnabled:(BOOL)enabled { WARN_DEPRECATED_DEV_MENU_EXPORT(); ((RCTDevSettings *)[_moduleRegistry moduleForName:"DevSettings"]).isProfilingEnabled = enabled; @@ -512,7 +512,7 @@ RCT_EXPORT_METHOD(setProfilingEnabled : (BOOL)enabled) return ((RCTDevSettings *)[_moduleRegistry moduleForName:"DevSettings"]).isProfilingEnabled; } -RCT_EXPORT_METHOD(setHotLoadingEnabled : (BOOL)enabled) +- (void)setHotLoadingEnabled:(BOOL)enabled { WARN_DEPRECATED_DEV_MENU_EXPORT(); ((RCTDevSettings *)[_moduleRegistry moduleForName:"DevSettings"]).isHotLoadingEnabled = enabled;