From d9e4908aeb421fe695cdda808a417ea9d0b8c988 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 RCTRedBox TurboModule (#57678) Summary: Pull Request resolved: https://github.com/react/react-native/pull/57678 Changelog: [Internal] `RCTRedBox` is a TurboModule: it conforms to `NativeRedBoxSpec` 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 `NativeRedBoxSpec` 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: D113579880 fbshipit-source-id: 6ced9af5367dbee000fcb25a3b70ef1fd6016dc6 --- packages/react-native/React/CoreModules/RCTRedBox.mm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/react-native/React/CoreModules/RCTRedBox.mm b/packages/react-native/React/CoreModules/RCTRedBox.mm index 91a9878ddb1..f2edecee813 100644 --- a/packages/react-native/React/CoreModules/RCTRedBox.mm +++ b/packages/react-native/React/CoreModules/RCTRedBox.mm @@ -222,12 +222,12 @@ RCT_EXPORT_MODULE() }); } -RCT_EXPORT_METHOD(setExtraData : (NSDictionary *)extraData forIdentifier : (NSString *)identifier) +- (void)setExtraData:(NSDictionary *)extraData forIdentifier:(NSString *)identifier { [_extraDataViewController addExtraData:extraData forIdentifier:identifier]; } -RCT_EXPORT_METHOD(dismiss) +- (void)dismiss { dispatch_async(dispatch_get_main_queue(), ^{ [self->_controller dismiss];