Skip to content

Commit 2cf34f8

Browse files
christophpurrermeta-codesync[bot]
authored andcommitted
Drop RCT_EXPORT_METHOD from RCTStatusBarManager TurboModule (#57686)
Summary: Pull Request resolved: #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
1 parent d9e4908 commit 2cf34f8

2 files changed

Lines changed: 12 additions & 6 deletions

File tree

packages/react-native/React/CoreModules/PlatformStubs/RCTStatusBarManager.mm

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,17 @@ @implementation RCTStatusBarManager
1717

1818
RCT_EXPORT_MODULE()
1919

20-
RCT_EXPORT_METHOD(getHeight : (RCTResponseSenderBlock)callback) {}
20+
- (void)getHeight:(RCTResponseSenderBlock)callback
21+
{
22+
}
2123

22-
RCT_EXPORT_METHOD(setStyle : (NSString *)style animated : (BOOL)animated) {}
24+
- (void)setStyle:(NSString *)style animated:(BOOL)animated
25+
{
26+
}
2327

24-
RCT_EXPORT_METHOD(setHidden : (BOOL)hidden withAnimation : (NSString *)withAnimation) {}
28+
- (void)setHidden:(BOOL)hidden withAnimation:(NSString *)withAnimation
29+
{
30+
}
2531

2632
- (facebook::react::ModuleConstants<JS::NativeStatusBarManagerIOS::Constants>)getConstants
2733
{

packages/react-native/React/CoreModules/RCTStatusBarManager.mm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,14 +136,14 @@ - (void)applicationWillChangeStatusBarFrame:(NSNotification *)notification
136136
[self emitEvent:kStatusBarFrameWillChange forNotification:notification];
137137
}
138138

139-
RCT_EXPORT_METHOD(getHeight : (RCTResponseSenderBlock)callback)
139+
- (void)getHeight:(RCTResponseSenderBlock)callback
140140
{
141141
callback(@[ @{
142142
@"height" : @(RCTUIStatusBarManager().statusBarFrame.size.height),
143143
} ]);
144144
}
145145

146-
RCT_EXPORT_METHOD(setStyle : (NSString *)style animated : (BOOL)animated)
146+
- (void)setStyle:(NSString *)style animated:(BOOL)animated
147147
{
148148
dispatch_async(dispatch_get_main_queue(), ^{
149149
UIStatusBarStyle statusBarStyle = [RCTConvert UIStatusBarStyle:style];
@@ -159,7 +159,7 @@ - (void)applicationWillChangeStatusBarFrame:(NSNotification *)notification
159159
});
160160
}
161161

162-
RCT_EXPORT_METHOD(setHidden : (BOOL)hidden withAnimation : (NSString *)withAnimation)
162+
- (void)setHidden:(BOOL)hidden withAnimation:(NSString *)withAnimation
163163
{
164164
dispatch_async(dispatch_get_main_queue(), ^{
165165
UIStatusBarAnimation animation = [RCTConvert UIStatusBarAnimation:withAnimation];

0 commit comments

Comments
 (0)