Skip to content

Commit

Permalink
【iOS】Fix Alert userInterfaceStyle having no effect (#39346)
Browse files Browse the repository at this point in the history
Summary:
Fixes #38852

## Changelog:

[IOS] [FIXED] - Fix Alert userInterfaceStyle having no effect

Pull Request resolved: #39346

Test Plan: Run the demo from #38852 .

Reviewed By: cipolleschi

Differential Revision: D49100720

Pulled By: dmytrorykun

fbshipit-source-id: cf8213dafc840720e9d74626e147804ea129cdf4
  • Loading branch information
zhongwuzw authored and facebook-github-bot committed Sep 11, 2023
1 parent bf955a0 commit 0e150d0
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/react-native/React/CoreModules/RCTAlertController.mm
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,13 @@ - (UIWindow *)alertWindow

- (void)show:(BOOL)animated completion:(void (^)(void))completion
{
UIUserInterfaceStyle style = RCTSharedApplication().delegate.window.overrideUserInterfaceStyle
? RCTSharedApplication().delegate.window.overrideUserInterfaceStyle
: UIUserInterfaceStyleUnspecified;
UIUserInterfaceStyle style = self.overrideUserInterfaceStyle;
if (style == UIUserInterfaceStyleUnspecified) {
style = RCTSharedApplication().delegate.window.overrideUserInterfaceStyle
? RCTSharedApplication().delegate.window.overrideUserInterfaceStyle
: UIUserInterfaceStyleUnspecified;
}

self.overrideUserInterfaceStyle = style;

[self.alertWindow makeKeyAndVisible];
Expand Down

0 comments on commit 0e150d0

Please sign in to comment.