diff --git a/angular/src/directives/proxies.ts b/angular/src/directives/proxies.ts
index 6588756042..0bd316fb08 100644
--- a/angular/src/directives/proxies.ts
+++ b/angular/src/directives/proxies.ts
@@ -492,7 +492,7 @@ export class MenuToggle {
}
export declare interface Nav extends StencilComponents<'IonNav'> {}
-@Component({ selector: 'ion-nav', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, template: '', inputs: ['swipeGesture', 'animated', 'delegate', 'rootParams', 'root'] })
+@Component({ selector: 'ion-nav', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, template: '', inputs: ['swipeGesture', 'animated', 'animation', 'delegate', 'rootParams', 'root'] })
export class Nav {
ionNavWillLoad: EventEmitter;
ionNavWillChange: EventEmitter;
@@ -501,7 +501,7 @@ export class Nav {
constructor(r: ElementRef) {
const el = r.nativeElement;
proxyMethods(this, el, ['push', 'insert', 'insertPages', 'pop', 'popTo', 'popToRoot', 'removeIndex', 'setRoot', 'setPages', 'setRouteId', 'getRouteId', 'getActive', 'getByIndex', 'canGoBack', 'getPrevious']);
- proxyInputs(this, el, ['swipeGesture', 'animated', 'delegate', 'rootParams', 'root']);
+ proxyInputs(this, el, ['swipeGesture', 'animated', 'animation', 'delegate', 'rootParams', 'root']);
proxyOutputs(this, el, ['ionNavWillLoad', 'ionNavWillChange', 'ionNavDidChange']);
}
}
diff --git a/core/src/components.d.ts b/core/src/components.d.ts
index 55af7e4a9f..f9fccc9484 100644
--- a/core/src/components.d.ts
+++ b/core/src/components.d.ts
@@ -2782,6 +2782,7 @@ export namespace Components {
* If the nav should animate the components or not
*/
'animated': boolean;
+ 'animation'?: AnimationBuilder;
/**
* Returns true or false if the current view can go back
*/
@@ -2855,6 +2856,7 @@ export namespace Components {
* If the nav should animate the components or not
*/
'animated'?: boolean;
+ 'animation'?: AnimationBuilder;
'delegate'?: FrameworkDelegate;
/**
* Event fired when the nav has changed components
@@ -3619,7 +3621,7 @@ export namespace Components {
interface IonRouterOutlet {
'animated': boolean;
- 'animationBuilder'?: AnimationBuilder;
+ 'animation'?: AnimationBuilder;
'commit': (enteringEl: HTMLElement, leavingEl: HTMLElement | undefined, opts?: RouterOutletOptions | undefined) => Promise;
'delegate'?: FrameworkDelegate;
/**
@@ -3634,7 +3636,7 @@ export namespace Components {
}
interface IonRouterOutletAttributes extends StencilHTMLAttributes {
'animated'?: boolean;
- 'animationBuilder'?: AnimationBuilder;
+ 'animation'?: AnimationBuilder;
'delegate'?: FrameworkDelegate;
'onIonNavDidChange'?: (event: CustomEvent) => void;
'onIonNavWillChange'?: (event: CustomEvent) => void;
diff --git a/core/src/components/nav/nav.tsx b/core/src/components/nav/nav.tsx
index b1a2e3c5d5..203f02b626 100644
--- a/core/src/components/nav/nav.tsx
+++ b/core/src/components/nav/nav.tsx
@@ -1,7 +1,7 @@
import { Build, Component, Element, Event, EventEmitter, Method, Prop, QueueApi, Watch } from '@stencil/core';
import { ViewLifecycle } from '../..';
-import { Animation, ComponentProps, Config, FrameworkDelegate, Gesture, GestureDetail, Mode, NavComponent, NavOptions, NavOutlet, NavResult, RouteID, RouteWrite, TransitionDoneFn, TransitionInstruction, ViewController } from '../../interface';
+import { Animation, AnimationBuilder, ComponentProps, Config, FrameworkDelegate, Gesture, GestureDetail, Mode, NavComponent, NavOptions, NavOutlet, NavResult, RouteID, RouteWrite, TransitionDoneFn, TransitionInstruction, ViewController } from '../../interface';
import { assert } from '../../utils/helpers';
import { TransitionOptions, lifecycle, setPageHidden, transition } from '../../utils/transition';
@@ -27,11 +27,8 @@ export class Nav implements NavOutlet {
@Element() el!: HTMLElement;
@Prop({ context: 'queue' }) queue!: QueueApi;
-
@Prop({ context: 'config' }) config!: Config;
-
@Prop({ context: 'window' }) win!: Window;
-
@Prop({ connect: 'ion-animation-controller' }) animationCtrl!: HTMLIonAnimationControllerElement;
/**
@@ -49,6 +46,7 @@ export class Nav implements NavOutlet {
* If the nav should animate the components or not
*/
@Prop() animated = true;
+ @Prop() animation?: AnimationBuilder;
/** @hidden */
@Prop() delegate?: FrameworkDelegate;
@@ -795,6 +793,7 @@ export class Nav implements NavOutlet {
queue: this.queue,
window: this.win,
baseEl: this.el,
+ animationBuilder: this.animation || opts.animationBuilder || this.config.get('navAnimation'),
progressCallback,
animated,
diff --git a/core/src/components/router-outlet/route-outlet.tsx b/core/src/components/router-outlet/route-outlet.tsx
index 4f256278c4..d532e7bb9a 100644
--- a/core/src/components/router-outlet/route-outlet.tsx
+++ b/core/src/components/router-outlet/route-outlet.tsx
@@ -25,7 +25,7 @@ export class RouterOutlet implements ComponentInterface, NavOutlet {
@Prop({ context: 'queue' }) queue!: QueueApi;
@Prop() animated = true;
- @Prop() animationBuilder?: AnimationBuilder;
+ @Prop() animation?: AnimationBuilder;
@Prop() delegate?: FrameworkDelegate;
@Event() ionNavWillLoad!: EventEmitter;
@@ -124,11 +124,14 @@ export class RouterOutlet implements ComponentInterface, NavOutlet {
const { mode, queue, animationCtrl, win, el } = this;
const animated = this.animated && this.config.getBoolean('animated', true);
+ const animationBuilder = this.animation || opts.animationBuilder || this.config.get('navAnimation');
+
await transition({
mode,
queue,
animated,
animationCtrl,
+ animationBuilder,
window: win,
enteringEl,
leavingEl,
diff --git a/core/src/utils/config.ts b/core/src/utils/config.ts
index b35e89bc99..5aaf9ceb4b 100644
--- a/core/src/utils/config.ts
+++ b/core/src/utils/config.ts
@@ -1,4 +1,4 @@
-import { Mode } from '../interface';
+import { AnimationBuilder, Mode } from '../interface';
export interface IonicConfig {
/**
@@ -33,21 +33,23 @@ export interface IonicConfig {
tabbarLayout?: string;
tabbarHighlight?: boolean;
- actionSheetEnter?: string;
- alertEnter?: string;
- loadingEnter?: string;
- modalEnter?: string;
- popoverEnter?: string;
- toastEnter?: string;
- pickerEnter?: string;
+ navAnimation?: AnimationBuilder;
- actionSheetLeave?: string;
- alertLeave?: string;
- loadingLeave?: string;
- modalLeave?: string;
- popoverLeave?: string;
- toastLeave?: string;
- pickerLeave?: string;
+ actionSheetEnter?: AnimationBuilder;
+ alertEnter?: AnimationBuilder;
+ loadingEnter?: AnimationBuilder;
+ modalEnter?: AnimationBuilder;
+ popoverEnter?: AnimationBuilder;
+ toastEnter?: AnimationBuilder;
+ pickerEnter?: AnimationBuilder;
+
+ actionSheetLeave?: AnimationBuilder;
+ alertLeave?: AnimationBuilder;
+ loadingLeave?: AnimationBuilder;
+ modalLeave?: AnimationBuilder;
+ popoverLeave?: AnimationBuilder;
+ toastLeave?: AnimationBuilder;
+ pickerLeave?: AnimationBuilder;
_forceStatusbarPadding?: boolean;
}