fix(nav): immediately stop if view removed before trans finished

This commit is contained in:
Adam Bradley
2016-02-20 22:43:17 -06:00
parent 22ec46403a
commit 4fabadecb7

View File

@ -692,31 +692,14 @@ export class NavController extends Ion {
if (forcedActive) { if (forcedActive) {
// this scenario happens when a remove is going on // this scenario happens when a remove is going on
// during a transition // during a transition
let resolve;
let promise = new Promise(res => { resolve = res; });
if (!opts.animation) {
opts.animation = forcedActive.getTransitionName(opts.direction);
}
if (this._trans) { if (this._trans) {
this._trans this._trans.stop();
.onFinish(() => {
opts.animate = false;
this._transition(forcedActive, null, opts, (hasCompleted: boolean) => {
// transition has completed!!
resolve(hasCompleted);
});
}, false, true)
.stop();
this._trans.destroy(); this._trans.destroy();
this._trans = null; this._trans = null;
this._cleanup();
} else {
resolve(false);
} }
return promise; return Promise.resolve(false);
} }
} }