mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
614e6025ab
Summary: Fixes a build error relating to RCTAlertController import when embedding react-native into existing iOS app. This PR resolves the issue detailed in https://github.com/facebook/react-native/issues/32356 ## Changelog Adjusts the import syntax which was added in: https://github.com/facebook/react-native/commit/f319ff321c4b7c0929b99e3ebe7e1ce1fa50b34c#diff-56beca6ee071cdd162c269ce765ab12d5af8c8c0ca840bca1e9d1f59e9fab790 Existing: #import "RCTAlertController.h" New: #import <React/RCTAlertController.h> [iOS] [Fix] - Fix RCTAlertController import build error when embedded in existing iOS projects Pull Request resolved: https://github.com/facebook/react-native/pull/32457 Test Plan: Build this branch in existing iOS project using swift, and should not have the build error described in the issue above. Would also like to have this fix cherry-pick'd to release 0.63 after merging. Reviewed By: RSNara Differential Revision: D31861814 Pulled By: charlesbdudley fbshipit-source-id: e60f80c8ea982e400cbf6d9375037d4197bbb8a3
42 lines
946 B
Objective-C
42 lines
946 B
Objective-C
/*
|
|
* Copyright (c) Facebook, Inc. and its 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>
|
|
|
|
@interface RCTAlertController ()
|
|
|
|
@property (nonatomic, strong) UIWindow *alertWindow;
|
|
|
|
@end
|
|
|
|
@implementation RCTAlertController
|
|
|
|
- (UIWindow *)alertWindow
|
|
{
|
|
if (_alertWindow == nil) {
|
|
_alertWindow = [[UIWindow alloc] initWithFrame:RCTSharedApplication().keyWindow.bounds];
|
|
_alertWindow.rootViewController = [UIViewController new];
|
|
_alertWindow.windowLevel = UIWindowLevelAlert + 1;
|
|
}
|
|
return _alertWindow;
|
|
}
|
|
|
|
- (void)show:(BOOL)animated completion:(void (^)(void))completion
|
|
{
|
|
[self.alertWindow makeKeyAndVisible];
|
|
[self.alertWindow.rootViewController presentViewController:self animated:animated completion:completion];
|
|
}
|
|
|
|
- (void)hide
|
|
{
|
|
_alertWindow = nil;
|
|
}
|
|
|
|
@end
|