From 455c32254c8acf19156bd1bda15dc80af40379ef 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 RCTDevSettings TurboModule (#57682) Summary: Pull Request resolved: https://github.com/react/react-native/pull/57682 Changelog: [Internal] `RCTDevSettings` is a TurboModule: it conforms to `NativeDevSettingsSpec` 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 `NativeDevSettingsSpec` 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: D113579870 fbshipit-source-id: 9a9c9e6c83fa0fdc59174edee5ed4344d699343d --- .../React/CoreModules/RCTDevSettings.mm | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/react-native/React/CoreModules/RCTDevSettings.mm b/packages/react-native/React/CoreModules/RCTDevSettings.mm index cc4cb1c74e5..0698f4a93fb 100644 --- a/packages/react-native/React/CoreModules/RCTDevSettings.mm +++ b/packages/react-native/React/CoreModules/RCTDevSettings.mm @@ -313,22 +313,22 @@ RCT_EXPORT_MODULE() return NO; } -RCT_EXPORT_METHOD(reload) +- (void)reload { RCTTriggerReloadCommandListeners(@"Unknown From JS"); } -RCT_EXPORT_METHOD(reloadWithReason : (NSString *)reason) +- (void)reloadWithReason:(NSString *)reason { RCTTriggerReloadCommandListeners(reason); } -RCT_EXPORT_METHOD(onFastRefresh) +- (void)onFastRefresh { [self.bridge onFastRefresh]; } -RCT_EXPORT_METHOD(setIsShakeToShowDevMenuEnabled : (BOOL)enabled) +- (void)setIsShakeToShowDevMenuEnabled:(BOOL)enabled { [self _updateSettingWithValue:@(enabled) forKey:kRCTDevSettingShakeToShowDevMenu]; } @@ -338,7 +338,7 @@ RCT_EXPORT_METHOD(setIsShakeToShowDevMenuEnabled : (BOOL)enabled) return _isShakeGestureEnabled && [[self settingForKey:kRCTDevSettingShakeToShowDevMenu] boolValue]; } -RCT_EXPORT_METHOD(setProfilingEnabled : (BOOL)enabled) +- (void)setProfilingEnabled:(BOOL)enabled { [self _updateSettingWithValue:@(enabled) forKey:kRCTDevSettingProfilingEnabled]; [self _profilingSettingDidChange]; @@ -368,7 +368,7 @@ RCT_EXPORT_METHOD(setProfilingEnabled : (BOOL)enabled) } } -RCT_EXPORT_METHOD(setHotLoadingEnabled : (BOOL)enabled) +- (void)setHotLoadingEnabled:(BOOL)enabled { if (self.isHotLoadingEnabled != enabled) { [self _updateSettingWithValue:@(enabled) forKey:kRCTDevSettingHotLoadingEnabled]; @@ -390,7 +390,7 @@ RCT_EXPORT_METHOD(setHotLoadingEnabled : (BOOL)enabled) return [[self settingForKey:kRCTDevSettingHotLoadingEnabled] boolValue]; } -RCT_EXPORT_METHOD(toggleElementInspector) +- (void)toggleElementInspector { BOOL value = [[self settingForKey:kRCTDevSettingIsInspectorShown] boolValue]; [self _updateSettingWithValue:@(!value) forKey:kRCTDevSettingIsInspectorShown]; @@ -403,7 +403,7 @@ RCT_EXPORT_METHOD(toggleElementInspector) } } -RCT_EXPORT_METHOD(addMenuItem : (NSString *)title) +- (void)addMenuItem:(NSString *)title { __weak __typeof(self) weakSelf = self; [(RCTDevMenu *)[self.moduleRegistry moduleForName:"DevMenu"] @@ -494,7 +494,7 @@ RCT_EXPORT_METHOD(addMenuItem : (NSString *)title) } } -RCT_EXPORT_METHOD(openDebugger) +- (void)openDebugger { #if RCT_ENABLE_INSPECTOR [RCTInspectorDevServerHelper