fix(nav): no animation

This commit is contained in:
Manu Mtz.-Almeida
2018-03-27 12:36:37 +02:00
parent 113af9e53b
commit 4fdfddb6b8
3 changed files with 57 additions and 48 deletions

View File

@@ -607,11 +607,8 @@ export class NavControllerBase implements NavOutlet {
// we should animate (duration > 0) if the pushed page is not the first one (startup)
// or if it is a portal (modal, actionsheet, etc.)
const shouldAnimate = this.animated && this._init && this._views.length > 1;
const animationBuilder = (shouldAnimate)
? this.mode === 'ios' ? iosTransitionAnimation : mdTransitionAnimation
: undefined;
const animationBuilder = this.getAnimationBuilder(ti.opts);
const progressAnimation = ti.opts.progressAnimation
? (animation: Animation) => this._sbTrns = animation
@@ -662,6 +659,14 @@ export class NavControllerBase implements NavOutlet {
};
}
private getAnimationBuilder(opts: NavOptions) {
if (opts.duration === 0 || !this._init || this.animated === false || this._views.length <= 1) {
return undefined;
}
const mode = opts.animation || this.config.get('pageTransition', this.mode);
return mode === 'ios' ? iosTransitionAnimation : mdTransitionAnimation;
}
private _insertViewAt(view: ViewController, index: number) {
const existingIndex = this._views.indexOf(view);
if (existingIndex > -1) {

View File

@@ -24,10 +24,16 @@ export class RouterOutlet implements NavOutlet {
@Prop({context: 'config'}) config: Config;
@Prop({connect: 'ion-animation-controller'}) animationCtrl: HTMLIonAnimationControllerElement;
@Prop() animated = true;
@Prop() animated: boolean;
@Prop() animationBuilder: AnimationBuilder;
@Prop() delegate: FrameworkDelegate;
componentWillLoad() {
if (this.animated === undefined) {
this.animated = this.config.getBoolean('animate', true);
}
}
componentDidUnload() {
this.activeEl = this.activeComponent = undefined;
}