fix(dialogs-ios): dialogs not showing in single page apps (non Frame based apps) (#6000)

This commit is contained in:
Alexander Djenkov
2018-07-03 10:23:51 +03:00
committed by Martin Yankov
parent e557d66f0d
commit 0082dfbdb0

View File

@ -5,6 +5,7 @@ import { View, ios as iosView } from "../core/view";
import { ConfirmOptions, PromptOptions, PromptResult, LoginOptions, LoginResult, ActionOptions } from "."; import { ConfirmOptions, PromptOptions, PromptResult, LoginOptions, LoginResult, ActionOptions } from ".";
import { getCurrentPage, getLabelColor, getButtonColors, getTextFieldColor, isDialogOptions, inputType, ALERT, OK, CONFIRM, CANCEL, PROMPT, LOGIN } from "./dialogs-common"; import { getCurrentPage, getLabelColor, getButtonColors, getTextFieldColor, isDialogOptions, inputType, ALERT, OK, CONFIRM, CANCEL, PROMPT, LOGIN } from "./dialogs-common";
import { isString, isDefined, isFunction } from "../../utils/types"; import { isString, isDefined, isFunction } from "../../utils/types";
import { getRootView } from "../../application";
export * from "./dialogs-common"; export * from "./dialogs-common";
@ -198,20 +199,16 @@ export function login(): Promise<LoginResult> {
} }
function showUIAlertController(alertController: UIAlertController) { function showUIAlertController(alertController: UIAlertController) {
let currentPage = getCurrentPage(); let currentView = getCurrentPage() || getRootView();
if (currentPage) {
let view: View = currentPage;
let viewController: UIViewController = currentPage.ios;
if (currentPage.modal) { if (currentView) {
view = currentPage.modal; currentView = currentView.modal || currentView;
if (view.ios instanceof UIViewController) { let viewController: UIViewController = currentView.ios;
viewController = view.ios;
} else { if (!(currentView.ios instanceof UIViewController)) {
const parentWithController = iosView.getParentWithViewController(view); const parentWithController = iosView.getParentWithViewController(currentView);
viewController = parentWithController ? parentWithController.viewController : undefined; viewController = parentWithController ? parentWithController.viewController : undefined;
}
} }
if (viewController) { if (viewController) {