mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-17 04:41:36 +08:00
Merge pull request #1827 from NativeScript/feature/show-modal-api
Page.showModal API extended to accept page instance
This commit is contained in:
@ -212,12 +212,17 @@ export class Page extends ContentView implements dts.Page {
|
|||||||
this._showNativeModalView(<any>frame.topmost().currentPage, undefined, undefined, true);
|
this._showNativeModalView(<any>frame.topmost().currentPage, undefined, undefined, true);
|
||||||
return this;
|
return this;
|
||||||
} else {
|
} else {
|
||||||
var moduleName: string = arguments[0];
|
|
||||||
var context: any = arguments[1];
|
var context: any = arguments[1];
|
||||||
var closeCallback: Function = arguments[2];
|
var closeCallback: Function = arguments[2];
|
||||||
var fullscreen: boolean = arguments[3];
|
var fullscreen: boolean = arguments[3];
|
||||||
|
|
||||||
var page = <Page>frame.resolvePageFromEntry({ moduleName: moduleName });
|
var page: Page;
|
||||||
|
if (arguments[0] instanceof Page) {
|
||||||
|
page = <Page>arguments[0];
|
||||||
|
} else {
|
||||||
|
page = <Page>frame.resolvePageFromEntry({ moduleName: arguments[0] });
|
||||||
|
}
|
||||||
|
|
||||||
page._showNativeModalView(this, context, closeCallback, fullscreen);
|
page._showNativeModalView(this, context, closeCallback, fullscreen);
|
||||||
return page;
|
return page;
|
||||||
}
|
}
|
||||||
|
9
ui/page/page.d.ts
vendored
9
ui/page/page.d.ts
vendored
@ -182,6 +182,15 @@ declare module "ui/page" {
|
|||||||
*/
|
*/
|
||||||
showModal(moduleName: string, context: any, closeCallback: Function, fullscreen?: boolean): Page;
|
showModal(moduleName: string, context: any, closeCallback: Function, fullscreen?: boolean): Page;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shows the page contained in moduleName as a modal view.
|
||||||
|
* @param page - Page instance to be shown modally.
|
||||||
|
* @param context - Any context you want to pass to the modally shown page. This same context will be available in the arguments of the Page.shownModally event handler.
|
||||||
|
* @param closeCallback - A function that will be called when the page is closed. Any arguments provided when calling ShownModallyData.closeCallback will be available here.
|
||||||
|
* @param fullscreen - An optional parameter specifying whether to show the modal page in full-screen mode.
|
||||||
|
*/
|
||||||
|
showModal(page: Page, context: any, closeCallback: Function, fullscreen?: boolean): Page;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shows the page as a modal view.
|
* Shows the page as a modal view.
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user