Skip to content

Commit 98d25f5

Browse files
authored
fix(snackbar): iOS new option iosIgnorePresentedViewController
1 parent f30d81d commit 98d25f5

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/snackbar/snackbar.ios.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,20 @@ export class SnackBar extends SnackBarBase {
6868
currentView = currentView.modal || currentView;
6969
let viewController = currentView.viewController;
7070
while (viewController.presentedViewController) {
71+
// if there is alertDialog presenting another controller let s find it.
72+
// this can happen because if a page(controller) is showing an alert and we
73+
// want to show a modal/other page over that page we need to use the
74+
// current alert controller as presenting. So it will be the alertcontroller which
75+
// will actually be the presenting controller
7176
while (
7277
viewController.presentedViewController instanceof UIAlertController ||
7378
(viewController.presentedViewController['isAlertController'] && viewController.presentedViewController.presentedViewController)
7479
) {
7580
viewController = viewController.presentedViewController;
7681
}
77-
if (viewController.presentedViewController instanceof UIAlertController || viewController.presentedViewController['isAlertController']) {
82+
// we are now in a case where we have the parent presenting controller
83+
// let ignore or not the presentedViewController (alert dialog, popover ...)
84+
if (viewController.presentedViewController instanceof UIAlertController || viewController.presentedViewController['isAlertController'] || options.iosIgnorePresentedViewController?.(viewController.presentedViewController)) {
7885
break;
7986
} else {
8087
viewController = viewController.presentedViewController;

0 commit comments

Comments
 (0)