FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix(dialogs-ios): dialogs not showing in single page apps (non Frame … · NativeScript/NativeScript@0082dfb · GitHub

Commit 0082dfb

Browse files
authored andcommitted
fix(dialogs-ios): dialogs not showing in single page apps (non Frame based apps) (#6000)
1 parent e557d66 commit 0082dfb

1 file changed

Lines changed: 11 additions & 14 deletions

File tree

‎tns-core-modules/ui/dialogs/dialogs.ios.ts‎

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { View, ios as iosView } from "../core/view";
55
import { ConfirmOptions, PromptOptions, PromptResult, LoginOptions, LoginResult, ActionOptions } from ".";
66
import { getCurrentPage, getLabelColor, getButtonColors, getTextFieldColor, isDialogOptions, inputType, ALERT, OK, CONFIRM, CANCEL, PROMPT, LOGIN } from "./dialogs-common";
77
import { isString, isDefined, isFunction } from "../../utils/types";
8+
import { getRootView } from "../../application";
89

910
export * from "./dialogs-common";
1011

@@ -198,20 +199,16 @@ export function login(): Promise<LoginResult> {
198199
}
199200

200201
function showUIAlertController(alertController: UIAlertController) {
201-
let currentPage = getCurrentPage();
202-
if (currentPage) {
203-
let view: View = currentPage;
204-
let viewController: UIViewController = currentPage.ios;
205-
206-
if (currentPage.modal) {
207-
view = currentPage.modal;
208-
209-
if (view.ios instanceof UIViewController) {
210-
viewController = view.ios;
211-
} else {
212-
const parentWithController = iosView.getParentWithViewController(view);
213-
viewController = parentWithController ? parentWithController.viewController : undefined;
214-
}
202+
let currentView = getCurrentPage() || getRootView();
203+
204+
if (currentView) {
205+
currentView = currentView.modal || currentView;
206+
207+
let viewController: UIViewController = currentView.ios;
208+
209+
if (!(currentView.ios instanceof UIViewController)) {
210+
const parentWithController = iosView.getParentWithViewController(currentView);
211+
viewController = parentWithController ? parentWithController.viewController : undefined;
215212
}
216213

217214
if (viewController) {

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL