From a27d495b7c85f709cea4d8d470c63d4a20583171 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 RCTExceptionsManager TurboModule (#57684) Summary: Pull Request resolved: https://github.com/react/react-native/pull/57684 Changelog: [Internal] `RCTExceptionsManager` is a TurboModule: it conforms to `NativeExceptionsManagerSpec` 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 `NativeExceptionsManagerSpec` 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: D113579875 fbshipit-source-id: 41aaed7f15443da5aadc0c18735732d4811dbe9b --- .../React/CoreModules/RCTExceptionsManager.mm | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/packages/react-native/React/CoreModules/RCTExceptionsManager.mm b/packages/react-native/React/CoreModules/RCTExceptionsManager.mm index cdaae3aee7f..9b3b56c3371 100644 --- a/packages/react-native/React/CoreModules/RCTExceptionsManager.mm +++ b/packages/react-native/React/CoreModules/RCTExceptionsManager.mm @@ -87,24 +87,22 @@ RCT_EXPORT_MODULE() } // TODO(T205456329): This method is deprecated in favour of reportException. Delete in v0.77 -RCT_EXPORT_METHOD( - reportSoftException : (NSString *)message stack : (NSArray *)stack exceptionId : (double) - exceptionId) +- (void)reportSoftException:(NSString *)message stack:(NSArray *)stack exceptionId:(double)exceptionId { [self reportSoft:message stack:stack exceptionId:exceptionId extraDataAsJSON:nil]; } // TODO(T205456329): This method is deprecated in favour of reportException. Delete in v0.77 -RCT_EXPORT_METHOD( - reportFatalException : (NSString *)message stack : (NSArray *)stack exceptionId : (double) - exceptionId) +- (void)reportFatalException:(NSString *)message stack:(NSArray *)stack exceptionId:(double)exceptionId { [self reportFatal:message stack:stack exceptionId:exceptionId extraDataAsJSON:nil]; } -RCT_EXPORT_METHOD(dismissRedbox) {} +- (void)dismissRedbox +{ +} -RCT_EXPORT_METHOD(reportException : (JS::NativeExceptionsManager::ExceptionData &)data) +- (void)reportException:(JS::NativeExceptionsManager::ExceptionData &)data { NSMutableDictionary *mutableErrorData = [NSMutableDictionary new]; mutableErrorData[@"message"] = data.message();