Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion ios/RCCManagerModule.m
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ -(void)animateSnapshot:(UIView*)snapshot animationType:(NSString*)animationType

-(void)dismissAllModalPresenters:(NSMutableArray*)allPresentedViewControllers resolver:(RCTPromiseResolveBlock)resolve
{
UIViewController *rootViewController = [UIApplication sharedApplication].delegate.window.rootViewController;

if (allPresentedViewControllers.count > 0)
{
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0),^
Expand All @@ -151,7 +153,7 @@ -(void)dismissAllModalPresenters:(NSMutableArray*)allPresentedViewControllers re
{
counter++;

[[RCCManager sharedIntance] unregisterController:viewController];

if (viewController.presentedViewController != nil)
{
dispatch_semaphore_t dismiss_sema = dispatch_semaphore_create(0);
Expand All @@ -160,6 +162,10 @@ -(void)dismissAllModalPresenters:(NSMutableArray*)allPresentedViewControllers re
{
[viewController dismissViewControllerAnimated:NO completion:^()
{
if (rootViewController != viewController) {
[[RCCManager sharedIntance] unregisterController:viewController];
}

if (counter == allPresentedViewControllers.count && allPresentedViewControllers.count > 0)
{
[allPresentedViewControllers removeAllObjects];
Expand Down