mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
153aedce41
Summary: In an app using `UIScene`, `Alert` no longer pops up because the window that gets created are not attached to a scene. ## Changelog [iOS] [Fixed] - Fix `Alert` not showing in an app using `UIScene` Pull Request resolved: https://github.com/facebook/react-native/pull/34562 Test Plan: Use the test plan in https://github.com/facebook/react-native/issues/29295. This should not regress that fix. Reviewed By: cipolleschi Differential Revision: D39276976 Pulled By: lunaleaps fbshipit-source-id: e48e985ed4abec77d6f01a6c17292d664ed88f13
25 lines
702 B
Objective-C
25 lines
702 B
Objective-C
/*
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
#import <React/RCTUtils.h>
|
|
|
|
#import <React/RCTAlertController.h>
|
|
|
|
@implementation RCTAlertController
|
|
|
|
- (void)show:(BOOL)animated completion:(void (^)(void))completion
|
|
{
|
|
if (@available(iOS 13.0, *)) {
|
|
UIUserInterfaceStyle style =
|
|
RCTSharedApplication().delegate.window.overrideUserInterfaceStyle ?: UIUserInterfaceStyleUnspecified;
|
|
self.overrideUserInterfaceStyle = style;
|
|
}
|
|
[[RCTKeyWindow() rootViewController] presentViewController:self animated:animated completion:completion];
|
|
}
|
|
|
|
@end
|