@@ -5,6 +5,7 @@ import { View, ios as iosView } from "../core/view";
55import { ConfirmOptions , PromptOptions , PromptResult , LoginOptions , LoginResult , ActionOptions } from "." ;
66import { getCurrentPage , getLabelColor , getButtonColors , getTextFieldColor , isDialogOptions , inputType , ALERT , OK , CONFIRM , CANCEL , PROMPT , LOGIN } from "./dialogs-common" ;
77import { isString , isDefined , isFunction } from "../../utils/types" ;
8+ import { getRootView } from "../../application" ;
89
910export * from "./dialogs-common" ;
1011
@@ -198,20 +199,16 @@ export function login(): Promise<LoginResult> {
198199}
199200
200201function 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