mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 12:29:55 +08:00
fix(ViewController): nav must be set as soon as possible
fixes regression in 5a4c6093a72059577544dafe372e06018ee1ed19 fixes #10654
This commit is contained in:
@ -220,6 +220,10 @@ export class App {
|
||||
present(enteringView: ViewController, opts: NavOptions, appPortal?: AppPortal): Promise<any> {
|
||||
const portal = this._appRoot._getPortal(appPortal);
|
||||
|
||||
// Set Nav must be set here in order to dimiss() work synchnously.
|
||||
// TODO: move _setNav() to the earlier stages of NavController. _queueTrns()
|
||||
enteringView._setNav(portal);
|
||||
|
||||
opts.keyboardClose = false;
|
||||
opts.direction = DIRECTION_FORWARD;
|
||||
|
||||
|
@ -254,6 +254,21 @@ export class E2EPage {
|
||||
this.navCtrl.push(Page2);
|
||||
}, 500);
|
||||
}
|
||||
|
||||
presentLoadingOpenDismiss() {
|
||||
// debugger;
|
||||
const loading = this.loadingCtrl.create({
|
||||
content: 'Loading 1'
|
||||
});
|
||||
loading.present();
|
||||
loading.dismiss();
|
||||
|
||||
const loading2 = this.loadingCtrl.create({
|
||||
content: 'Loading 2'
|
||||
});
|
||||
loading2.present();
|
||||
loading2.dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
@Component({
|
||||
|
@ -22,6 +22,7 @@
|
||||
<button ion-button block (click)="presentLoadingMultiple()" color="danger">Multiple Loading</button>
|
||||
<button ion-button block (click)="presentLoadingMultipleNav()" color="danger">Multiple Nav Loading</button>
|
||||
<button ion-button block (click)="presentLoadingDismissNav()">Dismiss Page Change</button>
|
||||
<button ion-button block (click)="presentLoadingOpenDismiss()">Open->Dismiss (x2)</button>
|
||||
|
||||
</ion-content>
|
||||
|
||||
|
@ -775,7 +775,7 @@ export class NavControllerBase extends Ion implements NavController {
|
||||
assert(view._nav === this, 'view is not part of the nav');
|
||||
this._views.splice(index, 0, this._views.splice(existingIndex, 1)[0]);
|
||||
} else {
|
||||
assert(!view._nav, 'nav is used');
|
||||
assert(!view._nav || (this._isPortal && view._nav === this), 'nav is used');
|
||||
// this is a new view to add to the stack
|
||||
// create the new entering view
|
||||
view._setNav(this);
|
||||
|
@ -165,6 +165,7 @@ export class ViewController {
|
||||
*/
|
||||
dismiss(data?: any, role?: any, navOptions: NavOptions = {}): Promise<any> {
|
||||
if (!this._nav) {
|
||||
assert(this._state === ViewState.DESTROYED, 'ViewController does not have a valid _nav');
|
||||
return Promise.resolve(false);
|
||||
}
|
||||
if (this.isOverlay && !navOptions.minClickBlockDuration) {
|
||||
|
Reference in New Issue
Block a user