mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-22 21:48:42 +08:00
fix(nav): fire lifecycle events from app root portal
This commit is contained in:
@ -137,6 +137,7 @@ class E2EPage {
|
|||||||
`
|
`
|
||||||
})
|
})
|
||||||
class NavigableModal {
|
class NavigableModal {
|
||||||
|
|
||||||
constructor(public navCtrl: NavController) {}
|
constructor(public navCtrl: NavController) {}
|
||||||
|
|
||||||
submit() {
|
submit() {
|
||||||
@ -158,11 +159,11 @@ class NavigableModal {
|
|||||||
`
|
`
|
||||||
})
|
})
|
||||||
class NavigableModal2 {
|
class NavigableModal2 {
|
||||||
constructor(public navController: NavController) {
|
|
||||||
}
|
constructor(public navCtrl: NavController) {}
|
||||||
|
|
||||||
submit() {
|
submit() {
|
||||||
this.navController.pop();
|
this.navCtrl.pop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -193,6 +193,13 @@ export class NavControllerBase extends Ion implements NavController {
|
|||||||
|
|
||||||
// get the leaving view which the _insert() already set
|
// get the leaving view which the _insert() already set
|
||||||
let leavingView = this.getByState(STATE_INIT_LEAVE);
|
let leavingView = this.getByState(STATE_INIT_LEAVE);
|
||||||
|
if (!leavingView && this._isPortal) {
|
||||||
|
// if we didn't find an active view, and this is a portal
|
||||||
|
let activeNav = this._app.getActiveNav();
|
||||||
|
if (activeNav) {
|
||||||
|
leavingView = activeNav.getByState(STATE_INIT_LEAVE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// start the transition, fire resolve when done...
|
// start the transition, fire resolve when done...
|
||||||
this._transition(enteringView, leavingView, opts, done);
|
this._transition(enteringView, leavingView, opts, done);
|
||||||
@ -224,6 +231,14 @@ export class NavControllerBase extends Ion implements NavController {
|
|||||||
|
|
||||||
// first see if there's an active view
|
// first see if there's an active view
|
||||||
let view = this.getActive();
|
let view = this.getActive();
|
||||||
|
if (!view && this._isPortal) {
|
||||||
|
// if we didn't find an active view, and this is a portal
|
||||||
|
let activeNav = this._app.getActiveNav();
|
||||||
|
if (activeNav) {
|
||||||
|
view = activeNav.getActive();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (view) {
|
if (view) {
|
||||||
// there's an active view, set that it's initialized to leave
|
// there's an active view, set that it's initialized to leave
|
||||||
view.state = STATE_INIT_LEAVE;
|
view.state = STATE_INIT_LEAVE;
|
||||||
@ -343,6 +358,16 @@ export class NavControllerBase extends Ion implements NavController {
|
|||||||
// get the view thats ready to enter
|
// get the view thats ready to enter
|
||||||
let enteringView = this.getByState(STATE_INIT_ENTER);
|
let enteringView = this.getByState(STATE_INIT_ENTER);
|
||||||
|
|
||||||
|
if (!enteringView && this._isPortal) {
|
||||||
|
// if we didn't find an active view, and this is a portal
|
||||||
|
let activeNav = this._app.getActiveNav();
|
||||||
|
if (activeNav) {
|
||||||
|
enteringView = activeNav.last();
|
||||||
|
if (enteringView) {
|
||||||
|
enteringView.state = STATE_INIT_ENTER;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (!enteringView && !this._isPortal) {
|
if (!enteringView && !this._isPortal) {
|
||||||
// oh nos! no entering view to go to!
|
// oh nos! no entering view to go to!
|
||||||
// if there is no previous view that would enter in this nav stack
|
// if there is no previous view that would enter in this nav stack
|
||||||
|
@ -26,6 +26,7 @@ export class NavPortal extends NavControllerBase {
|
|||||||
) {
|
) {
|
||||||
super(null, app, config, keyboard, elementRef, zone, renderer, compiler, gestureCtrl);
|
super(null, app, config, keyboard, elementRef, zone, renderer, compiler, gestureCtrl);
|
||||||
this._isPortal = true;
|
this._isPortal = true;
|
||||||
|
this._init = true;
|
||||||
this.setViewport(viewPort);
|
this.setViewport(viewPort);
|
||||||
app.setPortal(this);
|
app.setPortal(this);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user