Skip to content

Commit

Permalink
use helper method to get topmost view controller (#80)
Browse files Browse the repository at this point in the history
  • Loading branch information
koenpunt authored Dec 4, 2017
1 parent 2368709 commit 640075e
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions SafariViewManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,9 @@ - (void)stopObserving
self.safariView.modalPresentationStyle = UIModalPresentationOverFullScreen;
}

UIViewController *ctrl = [[[[UIApplication sharedApplication] delegate] window] rootViewController];

// Cycle through view controllers to get the view closest to the foreground
while (ctrl.presentedViewController && !ctrl.isBeingDismissed) {
ctrl = ctrl.presentedViewController;
}

// get the view controller closest to the foreground
UIViewController *ctrl = RCTPresentedViewController();

// Display the Safari View
[ctrl presentViewController:self.safariView animated:YES completion:nil];

Expand Down

0 comments on commit 640075e

Please sign in to comment.