mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Fixed #727: Provide a way to get a reference to the currently showing modal page instance.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import observable = require("data/observable");
|
||||
import pages = require("ui/page");
|
||||
import textField = require("ui/text-field");
|
||||
import frame = require("ui/frame");
|
||||
|
||||
var context: any;
|
||||
var closeCallback: Function;
|
||||
@@ -13,6 +14,11 @@ export function onShownModally(args: pages.ShownModallyData) {
|
||||
console.log("login-page.onShownModally, context: " + args.context);
|
||||
context = args.context;
|
||||
closeCallback = args.closeCallback;
|
||||
var modalPage = <pages.Page>args.object;
|
||||
|
||||
if (frame.topmost().currentPage.modal !== args.object) {
|
||||
throw new Error(`frame.topmost().currentPage.modal.id: ${frame.topmost().currentPage.modal.id}; modalPage.id: ${modalPage.id}`);
|
||||
}
|
||||
}
|
||||
|
||||
export function onLoaded(args: observable.EventData) {
|
||||
|
||||
Reference in New Issue
Block a user