diff --git a/apps/modal-views-demo/login-page.ts b/apps/modal-views-demo/login-page.ts index 05435d74e..357c91e5a 100644 --- a/apps/modal-views-demo/login-page.ts +++ b/apps/modal-views-demo/login-page.ts @@ -9,6 +9,15 @@ var page: pages.Page; var usernameTextField: textField.TextField; var passwordTextField: textField.TextField; +export function onShowingModally(args: observable.EventData) { + console.log(">>> login-page.onShowingModally"); + var modalPage = args.object; + if (modalPage.ios && modalPage.ios.modalPresentationStyle === UIModalPresentationStyle.UIModalPresentationFullScreen) { + console.log(">>> Setting modalPage.ios.modalPresentationStyle to UIModalPresentationStyle.UIModalPresentationOverFullScreen"); + modalPage.ios.modalPresentationStyle = UIModalPresentationStyle.UIModalPresentationOverFullScreen; + } +} + export function onShownModally(args: pages.ShownModallyData) { console.log(">>> login-page.onShownModally, context: " + args.context); diff --git a/apps/modal-views-demo/login-page.xml b/apps/modal-views-demo/login-page.xml index f1b30a027..4d5a182e8 100644 --- a/apps/modal-views-demo/login-page.xml +++ b/apps/modal-views-demo/login-page.xml @@ -1,4 +1,5 @@ args.object; +} + export function onShownModally(args: ShownModallyData) { + TKUnit.assertNotNull(modalPage); TKUnit.wait(0.100); - var modalPage = args.object; if (args.context) { args.context.shownModally = true; } diff --git a/apps/tests/ui/page/modal-page.xml b/apps/tests/ui/page/modal-page.xml index e049008a4..3a168cf3e 100644 --- a/apps/tests/ui/page/modal-page.xml +++ b/apps/tests/ui/page/modal-page.xml @@ -1,4 +1,4 @@ - + diff --git a/ui/page/page-common.ts b/ui/page/page-common.ts index 2f2549171..0425f10bc 100644 --- a/ui/page/page-common.ts +++ b/ui/page/page-common.ts @@ -35,6 +35,7 @@ export class Page extends ContentView implements dts.Page { public static navigatingFromEvent = "navigatingFrom"; public static navigatedFromEvent = "navigatedFrom"; public static shownModallyEvent = "shownModally"; + public static showingModallyEvent = "showingModally"; protected _closeModalCallback: Function; @@ -251,6 +252,13 @@ export class Page extends ContentView implements dts.Page { }); } + protected _raiseShowingModallyEvent() { + this.notify({ + eventName: Page.showingModallyEvent, + object: this + }); + } + public _getStyleScope(): styleScope.StyleScope { return this._styleScope; } diff --git a/ui/page/page.android.ts b/ui/page/page.android.ts index c2267c50a..756fd9702 100644 --- a/ui/page/page.android.ts +++ b/ui/page/page.android.ts @@ -125,8 +125,9 @@ export class Page extends pageCommon.Page { this._dialogFragment = new DialogFragmentClass(this, fullscreen, function () { that.closeModal(); }); - this._dialogFragment.show(parent.frame.android.activity.getFragmentManager(), "dialog"); + super._raiseShowingModallyEvent(); + this._dialogFragment.show(parent.frame.android.activity.getFragmentManager(), "dialog"); super._raiseShownModallyEvent(parent, context, closeCallback); } diff --git a/ui/page/page.d.ts b/ui/page/page.d.ts index 1b4d8015c..bcc6040fa 100644 --- a/ui/page/page.d.ts +++ b/ui/page/page.d.ts @@ -61,6 +61,11 @@ declare module "ui/page" { */ public static actionBarHiddenProperty: dependencyObservable.Property; + /** + * String value used when hooking to showingModally event. + */ + public static showingModallyEvent: string; + /** * String value used when hooking to shownModally event. */ @@ -159,7 +164,12 @@ declare module "ui/page" { on(event: "navigatedFrom", callback: (args: NavigatedData) => void, thisArg?: any); /** - * Raised when the page is shown as a modal dialog. + * Raised before the page is shown as a modal dialog. + */ + on(event: "showingModally", callback: (args: observable.EventData) => void, thisArg?: any); + + /** + * Raised after the page is shown as a modal dialog. */ on(event: "shownModally", callback: (args: ShownModallyData) => void, thisArg?: any); diff --git a/ui/page/page.ios.ts b/ui/page/page.ios.ts index ced099440..1af9e86e2 100644 --- a/ui/page/page.ios.ts +++ b/ui/page/page.ios.ts @@ -241,6 +241,7 @@ export class Page extends pageCommon.Page { this._UIModalPresentationFormSheet = true; } + super._raiseShowingModallyEvent(); var that = this; parent.ios.presentViewControllerAnimatedCompletion(this._ios, false, function completion() { that._raiseShownModallyEvent(parent, context, closeCallback);