Merge pull request #954 from NativeScript/show-modal

added simple showModal() overload
This commit is contained in:
Vladimir Enchev
2015-10-19 11:10:02 +03:00
2 changed files with 17 additions and 3 deletions

View File

@ -197,9 +197,18 @@ export class Page extends ContentView implements dts.Page {
this._navigationContext = undefined;
}
public showModal(moduleName: string, context: any, closeCallback: Function, fullscreen?: boolean) {
var page = frameCommon.resolvePageFromEntry({ moduleName: moduleName });
(<Page>page)._showNativeModalView(this, context, closeCallback, fullscreen);
public showModal() {
if (arguments.length === 0) {
this._showNativeModalView(<any>frame.topmost().currentPage, undefined, undefined, true);
} else {
var moduleName: string = arguments[0];
var context: any = arguments[1];
var closeCallback: Function = arguments[2];
var fullscreen: boolean = arguments[3];
var page = frameCommon.resolvePageFromEntry({ moduleName: moduleName });
(<Page>page)._showNativeModalView(this, context, closeCallback, fullscreen);
}
}
public closeModal() {

5
ui/page/page.d.ts vendored
View File

@ -167,6 +167,11 @@ declare module "ui/page" {
*/
showModal(moduleName: string, context: any, closeCallback: Function, fullscreen?: boolean);
/**
* Shows the page as a modal view.
*/
showModal();
/**
* Closes the current modal dialog that this page is showing.
*/