From 2cf34f879935d1935a3d2c24993d592d4ace233d 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 RCTStatusBarManager TurboModule (#57686) Summary: Pull Request resolved: https://github.com/react/react-native/pull/57686 Changelog: [Internal] `RCTStatusBarManager` is a TurboModule: it conforms to `NativeStatusBarManagerIOSSpec` 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 `NativeStatusBarManagerIOSSpec` 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: D113579878 fbshipit-source-id: 377b2383d8f6e124150aa44a4b545f25794a5012 --- .../CoreModules/PlatformStubs/RCTStatusBarManager.mm | 12 +++++++++--- .../React/CoreModules/RCTStatusBarManager.mm | 6 +++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/packages/react-native/React/CoreModules/PlatformStubs/RCTStatusBarManager.mm b/packages/react-native/React/CoreModules/PlatformStubs/RCTStatusBarManager.mm index 1c4b2011412..12c27619f25 100644 --- a/packages/react-native/React/CoreModules/PlatformStubs/RCTStatusBarManager.mm +++ b/packages/react-native/React/CoreModules/PlatformStubs/RCTStatusBarManager.mm @@ -17,11 +17,17 @@ RCT_EXPORT_MODULE() -RCT_EXPORT_METHOD(getHeight : (RCTResponseSenderBlock)callback) {} +- (void)getHeight:(RCTResponseSenderBlock)callback +{ +} -RCT_EXPORT_METHOD(setStyle : (NSString *)style animated : (BOOL)animated) {} +- (void)setStyle:(NSString *)style animated:(BOOL)animated +{ +} -RCT_EXPORT_METHOD(setHidden : (BOOL)hidden withAnimation : (NSString *)withAnimation) {} +- (void)setHidden:(BOOL)hidden withAnimation:(NSString *)withAnimation +{ +} - (facebook::react::ModuleConstants)getConstants { diff --git a/packages/react-native/React/CoreModules/RCTStatusBarManager.mm b/packages/react-native/React/CoreModules/RCTStatusBarManager.mm index d8152818901..dc0a6568251 100644 --- a/packages/react-native/React/CoreModules/RCTStatusBarManager.mm +++ b/packages/react-native/React/CoreModules/RCTStatusBarManager.mm @@ -136,14 +136,14 @@ RCT_EXPORT_MODULE() [self emitEvent:kStatusBarFrameWillChange forNotification:notification]; } -RCT_EXPORT_METHOD(getHeight : (RCTResponseSenderBlock)callback) +- (void)getHeight:(RCTResponseSenderBlock)callback { callback(@[ @{ @"height" : @(RCTUIStatusBarManager().statusBarFrame.size.height), } ]); } -RCT_EXPORT_METHOD(setStyle : (NSString *)style animated : (BOOL)animated) +- (void)setStyle:(NSString *)style animated:(BOOL)animated { dispatch_async(dispatch_get_main_queue(), ^{ UIStatusBarStyle statusBarStyle = [RCTConvert UIStatusBarStyle:style]; @@ -159,7 +159,7 @@ RCT_EXPORT_METHOD(setStyle : (NSString *)style animated : (BOOL)animated) }); } -RCT_EXPORT_METHOD(setHidden : (BOOL)hidden withAnimation : (NSString *)withAnimation) +- (void)setHidden:(BOOL)hidden withAnimation:(NSString *)withAnimation { dispatch_async(dispatch_get_main_queue(), ^{ UIStatusBarAnimation animation = [RCTConvert UIStatusBarAnimation:withAnimation];