mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-17 04:41:36 +08:00
fix(dialogs-ios): dialogs not showing in single page apps (non Frame based apps) (#6000)
This commit is contained in:

committed by
Martin Yankov

parent
e557d66f0d
commit
0082dfbdb0
@ -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) {
|
||||||
|
Reference in New Issue
Block a user