Avoid presenting on view controller that's being dismissed

Summary:
Mitigates the issue in https://github.com/facebook/react-native/issues/10471, by not trying to present
a modal or alert view if the presenting view controller is already being dismissed.

Reviewed By: shergin

Differential Revision: D4962169

fbshipit-source-id: 593e3f21096458651d16677a3e030552f809bf02
This commit is contained in:
Pieter De Baets 2017-04-28 03:26:30 -07:00 committed by Facebook Github Bot
parent ae7edff707
commit 96d13b663b
1 changed files with 4 additions and 3 deletions

View File

@ -481,9 +481,10 @@ UIViewController *__nullable RCTPresentedViewController(void)
}
UIViewController *controller = RCTKeyWindow().rootViewController;
while (controller.presentedViewController) {
controller = controller.presentedViewController;
UIViewController *presentedController = controller.presentedViewController;
while (presentedController && ![presentedController isBeingDismissed]) {
controller = presentedController;
presentedController = controller.presentedViewController;
}
return controller;