mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
2968450195
Summary: Since extensions does not have access to sharedApplication, give them an option to set the presentedViewController. This will allow modules such as RCTAlertsManager to function correctly in extensions. Changelog: [General] [Added] - Added RCTUtilsUIOverride as a way to shortcut obtaining presentedViewController from sharedApplication to a supplied view controller for extensions. Reviewed By: PeteTheHeat Differential Revision: D18620886 fbshipit-source-id: c752a6e328588f388e23be5270bf7da277182cca
30 lines
626 B
Objective-C
30 lines
626 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 "RCTUtilsUIOverride.h"
|
|
|
|
@implementation RCTUtilsUIOverride
|
|
|
|
static UIViewController *_presentedViewController = nil;
|
|
|
|
+ (void)setPresentedViewController:(UIViewController *)presentedViewController
|
|
{
|
|
_presentedViewController = presentedViewController;
|
|
}
|
|
|
|
+ (UIViewController *)presentedViewController
|
|
{
|
|
return _presentedViewController;
|
|
}
|
|
|
|
+ (BOOL)hasPresentedViewController
|
|
{
|
|
return _presentedViewController != nil;
|
|
}
|
|
|
|
@end
|