From 7f2411bdf8874a5ac18bf7c91f027a99aed6fed0 Mon Sep 17 00:00:00 2001 From: Christoph Purrer Date: Fri, 24 Jul 2026 11:42:12 -0700 Subject: [PATCH 1/2] Drop RCT_EXPORT_METHOD from RCTClipboard TurboModule (#57671) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: Changelog: [Internal] `RCTClipboard` is a pure TurboModule: it conforms to `NativeClipboardSpec` and implements `getTurboModule:` returning `NativeClipboardSpecJSI`. For TurboModules, the JS->ObjC dispatch is driven by codegen (the generated spec supplies the `selector` and `TurboModuleMethodValueKind`, invoked at runtime via `NSMethodSignature`/`NSInvocation`), not by the `RCT_EXPORT_METHOD` macro's `__rct_export__` metadata. `setString:` and `getString:reject:` are async-void methods whose parameters are all concrete types (`NSString *`, promise blocks) — none is a generic `id` requiring `RCTConvert` coercion — so the macro is not functionally required. Convert both to plain ObjC method declarations; conformance to the codegen'd `NativeClipboardSpec` protocol keeps compiler-enforced signature parity. This is a signature-only refactor with no change to the JS-facing API (the codegen spec). The macro is intentionally retained elsewhere: sync methods, methods with `id` params relying on `RCTConvert`, and modules reachable via the legacy bridge/interop layer still need it. Differential Revision: D113568495 --- packages/react-native/React/CoreModules/RCTClipboard.mm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/react-native/React/CoreModules/RCTClipboard.mm b/packages/react-native/React/CoreModules/RCTClipboard.mm index f057c34f704c..ab5aea968ff7 100644 --- a/packages/react-native/React/CoreModules/RCTClipboard.mm +++ b/packages/react-native/React/CoreModules/RCTClipboard.mm @@ -26,7 +26,7 @@ - (dispatch_queue_t)methodQueue return dispatch_get_main_queue(); } -RCT_EXPORT_METHOD(setString : (NSString *)content) +- (void)setString:(NSString *)content { #if !TARGET_OS_TV UIPasteboard *clipboard = [UIPasteboard generalPasteboard]; @@ -34,7 +34,7 @@ - (dispatch_queue_t)methodQueue #endif } -RCT_EXPORT_METHOD(getString : (RCTPromiseResolveBlock)resolve reject : (__unused RCTPromiseRejectBlock)reject) +- (void)getString:(RCTPromiseResolveBlock)resolve reject:(__unused RCTPromiseRejectBlock)reject { #if !TARGET_OS_TV UIPasteboard *clipboard = [UIPasteboard generalPasteboard]; From 5019fbb30e83a8a8d4144fdb620a3122e3c346d3 Mon Sep 17 00:00:00 2001 From: Christoph Purrer Date: Fri, 24 Jul 2026 11:42:12 -0700 Subject: [PATCH 2/2] Drop RCT_EXPORT_METHOD from RCTAccessibilityManager TurboModule Summary: Changelog: [Internal] `RCTAccessibilityManager` is a TurboModule: it conforms to `NativeAccessibilityManagerSpec` 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 `NativeAccessibilityManagerSpec` 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. Differential Revision: D113579886 --- .../CoreModules/RCTAccessibilityManager.mm | 49 ++++++++----------- 1 file changed, 21 insertions(+), 28 deletions(-) diff --git a/packages/react-native/React/CoreModules/RCTAccessibilityManager.mm b/packages/react-native/React/CoreModules/RCTAccessibilityManager.mm index 19895271f141..29b03e6c1c79 100644 --- a/packages/react-native/React/CoreModules/RCTAccessibilityManager.mm +++ b/packages/react-native/React/CoreModules/RCTAccessibilityManager.mm @@ -274,9 +274,8 @@ - (void)setMultipliers:(NSDictionary *)multipliers return _multipliers; } -RCT_EXPORT_METHOD( - setAccessibilityContentSizeMultipliers : ( - JS::NativeAccessibilityManager::SpecSetAccessibilityContentSizeMultipliersJSMultipliers &)JSMultipliers) +- (void)setAccessibilityContentSizeMultipliers: + (JS::NativeAccessibilityManager::SpecSetAccessibilityContentSizeMultipliersJSMultipliers &)JSMultipliers { NSMutableDictionary *multipliers = [NSMutableDictionary new]; setMultipliers(multipliers, UIContentSizeCategoryExtraSmall, JSMultipliers.extraSmall()); @@ -308,7 +307,7 @@ static void setMultipliers( } } -RCT_EXPORT_METHOD(setAccessibilityFocus : (double)reactTag) +- (void)setAccessibilityFocus:(double)reactTag { dispatch_async(dispatch_get_main_queue(), ^{ UIView *view = [self.viewRegistry_DEPRECATED viewForReactTag:@(reactTag)]; @@ -316,14 +315,16 @@ static void setMultipliers( }); } -RCT_EXPORT_METHOD(announceForAccessibility : (NSString *)announcement) +- (void)announceForAccessibility:(NSString *)announcement { UIAccessibilityPostNotification(UIAccessibilityAnnouncementNotification, announcement); } -RCT_EXPORT_METHOD( - announceForAccessibilityWithOptions : (NSString *)announcement options : ( - JS::NativeAccessibilityManager::SpecAnnounceForAccessibilityWithOptionsOptions &)options) +- (void) + announceForAccessibilityWithOptions:(NSString *)announcement + options: + (JS::NativeAccessibilityManager::SpecAnnounceForAccessibilityWithOptionsOptions &) + options { NSMutableDictionary *attrsDictionary = [NSMutableDictionary new]; if (options.queue()) { @@ -356,47 +357,41 @@ static void setMultipliers( } } -RCT_EXPORT_METHOD(getMultiplier : (RCTResponseSenderBlock)callback) +- (void)getMultiplier:(RCTResponseSenderBlock)callback { if (callback) { callback(@[ @(self.multiplier) ]); } } -RCT_EXPORT_METHOD( - getCurrentBoldTextState : (RCTResponseSenderBlock)onSuccess onError : (__unused RCTResponseSenderBlock)onError) +- (void)getCurrentBoldTextState:(RCTResponseSenderBlock)onSuccess onError:(__unused RCTResponseSenderBlock)onError { onSuccess(@[ @(_isBoldTextEnabled) ]); } -RCT_EXPORT_METHOD( - getCurrentGrayscaleState : (RCTResponseSenderBlock)onSuccess onError : (__unused RCTResponseSenderBlock)onError) +- (void)getCurrentGrayscaleState:(RCTResponseSenderBlock)onSuccess onError:(__unused RCTResponseSenderBlock)onError { onSuccess(@[ @(_isGrayscaleEnabled) ]); } -RCT_EXPORT_METHOD( - getCurrentInvertColorsState : (RCTResponseSenderBlock)onSuccess onError : (__unused RCTResponseSenderBlock)onError) +- (void)getCurrentInvertColorsState:(RCTResponseSenderBlock)onSuccess onError:(__unused RCTResponseSenderBlock)onError { onSuccess(@[ @(_isInvertColorsEnabled) ]); } -RCT_EXPORT_METHOD( - getCurrentReduceMotionState : (RCTResponseSenderBlock)onSuccess onError : (__unused RCTResponseSenderBlock)onError) +- (void)getCurrentReduceMotionState:(RCTResponseSenderBlock)onSuccess onError:(__unused RCTResponseSenderBlock)onError { onSuccess(@[ @(_isReduceMotionEnabled) ]); } -RCT_EXPORT_METHOD( - getCurrentDarkerSystemColorsState : (RCTResponseSenderBlock)onSuccess onError : (__unused RCTResponseSenderBlock) - onError) +- (void)getCurrentDarkerSystemColorsState:(RCTResponseSenderBlock)onSuccess + onError:(__unused RCTResponseSenderBlock)onError { onSuccess(@[ @(_isDarkerSystemColorsEnabled) ]); } -RCT_EXPORT_METHOD( - getCurrentPrefersCrossFadeTransitionsState : (RCTResponseSenderBlock) - onSuccess onError : (__unused RCTResponseSenderBlock)onError) +- (void)getCurrentPrefersCrossFadeTransitionsState:(RCTResponseSenderBlock)onSuccess + onError:(__unused RCTResponseSenderBlock)onError { if (@available(iOS 14.0, *)) { onSuccess(@[ @(UIAccessibilityPrefersCrossFadeTransitions()) ]); @@ -405,15 +400,13 @@ static void setMultipliers( } } -RCT_EXPORT_METHOD( - getCurrentReduceTransparencyState : (RCTResponseSenderBlock)onSuccess onError : (__unused RCTResponseSenderBlock) - onError) +- (void)getCurrentReduceTransparencyState:(RCTResponseSenderBlock)onSuccess + onError:(__unused RCTResponseSenderBlock)onError { onSuccess(@[ @(_isReduceTransparencyEnabled) ]); } -RCT_EXPORT_METHOD( - getCurrentVoiceOverState : (RCTResponseSenderBlock)onSuccess onError : (__unused RCTResponseSenderBlock)onError) +- (void)getCurrentVoiceOverState:(RCTResponseSenderBlock)onSuccess onError:(__unused RCTResponseSenderBlock)onError { onSuccess(@[ @(_isVoiceOverEnabled) ]); }