From 01658cc13810f9d56174c23acb64ce75cba97228 Mon Sep 17 00:00:00 2001 From: Amit Shah Date: Fri, 20 Jan 2017 15:14:22 +0000 Subject: [PATCH] Fixed Safari view not being presentable from a modal --- SafariViewManager.m | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/SafariViewManager.m b/SafariViewManager.m index 14ec42e..0b80e64 100644 --- a/SafariViewManager.m +++ b/SafariViewManager.m @@ -54,8 +54,14 @@ - (dispatch_queue_t)methodQueue self.safariView.modalPresentationStyle = UIModalPresentationOverFullScreen; } - // Display the Safari View UIViewController *ctrl = [[[[UIApplication sharedApplication] delegate] window] rootViewController]; + + // Cycle through view controllers to get the view closest to the foreground + while (ctrl.presentedViewController) { + ctrl = ctrl.presentedViewController; + } + + // Display the Safari View [ctrl presentViewController:self.safariView animated:YES completion:nil]; [self.bridge.eventDispatcher sendDeviceEventWithName:@"SafariViewOnShow" body:nil];