mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
fix(nav): no animation
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user