(
enteringView: ViewController,
leavingView: ViewController | undefined,
ti: TransitionInstruction
)
| 865 | } |
| 866 | |
| 867 | private async transition( |
| 868 | enteringView: ViewController, |
| 869 | leavingView: ViewController | undefined, |
| 870 | ti: TransitionInstruction |
| 871 | ): Promise<NavResult> { |
| 872 | // we should animate (duration > 0) if the pushed page is not the first one (startup) |
| 873 | // or if it is a portal (modal, actionsheet, etc.) |
| 874 | const opts = ti.opts!; |
| 875 | |
| 876 | const progressCallback = opts.progressAnimation |
| 877 | ? (ani: Animation | undefined) => { |
| 878 | /** |
| 879 | * Because this progress callback is called asynchronously |
| 880 | * it is possible for the gesture to start and end before |
| 881 | * the animation is ever set. In that scenario, we should |
| 882 | * immediately call progressEnd so that the transition promise |
| 883 | * resolves and the gesture does not get locked up. |
| 884 | */ |
| 885 | if (ani !== undefined && !this.gestureOrAnimationInProgress) { |
| 886 | this.gestureOrAnimationInProgress = true; |
| 887 | ani.onFinish( |
| 888 | () => { |
| 889 | this.gestureOrAnimationInProgress = false; |
| 890 | }, |
| 891 | { oneTimeCallback: true } |
| 892 | ); |
| 893 | |
| 894 | /** |
| 895 | * Playing animation to beginning |
| 896 | * with a duration of 0 prevents |
| 897 | * any flickering when the animation |
| 898 | * is later cleaned up. |
| 899 | */ |
| 900 | ani.progressEnd(0, 0, 0); |
| 901 | } else { |
| 902 | this.sbAni = ani; |
| 903 | } |
| 904 | } |
| 905 | : undefined; |
| 906 | const mode = getIonMode(this); |
| 907 | const enteringEl = enteringView.element!; |
| 908 | // eslint-disable-next-line @typescript-eslint/prefer-optional-chain |
| 909 | const leavingEl = leavingView && leavingView.element!; |
| 910 | const animationOpts: TransitionOptions = { |
| 911 | mode, |
| 912 | showGoBack: this.canGoBackSync(enteringView), |
| 913 | baseEl: this.el, |
| 914 | progressCallback, |
| 915 | animated: this.animated && config.getBoolean('animated', true), |
| 916 | enteringEl, |
| 917 | leavingEl, |
| 918 | ...opts, |
| 919 | animationBuilder: opts.animationBuilder || this.animation || config.get('navAnimation'), |
| 920 | }; |
| 921 | const { hasCompleted } = await transition(animationOpts); |
| 922 | return this.transitionFinish(hasCompleted, enteringView, leavingView, opts); |
| 923 | } |
| 924 |
no test coverage detected