Executes all the transition instruction from the queue.
(ti: TransitionInstruction)
| 628 | |
| 629 | /** Executes all the transition instruction from the queue. */ |
| 630 | private async runTransition(ti: TransitionInstruction) { |
| 631 | try { |
| 632 | // set that this nav is actively transitioning |
| 633 | this.ionNavWillChange.emit(); |
| 634 | this.isTransitioning = true; |
| 635 | this.prepareTI(ti); |
| 636 | |
| 637 | const leavingView = this.getActiveSync(); |
| 638 | const enteringView = this.getEnteringView(ti, leavingView); |
| 639 | |
| 640 | if (!leavingView && !enteringView) { |
| 641 | throw new Error('no views in the stack to be removed'); |
| 642 | } |
| 643 | |
| 644 | if (enteringView && enteringView.state === VIEW_STATE_NEW) { |
| 645 | await enteringView.init(this.el); |
| 646 | } |
| 647 | this.postViewInit(enteringView, leavingView, ti); |
| 648 | |
| 649 | // Needs transition? |
| 650 | const requiresTransition = |
| 651 | (ti.enteringRequiresTransition || ti.leavingRequiresTransition) && enteringView !== leavingView; |
| 652 | if (requiresTransition && ti.opts && leavingView) { |
| 653 | const isBackDirection = ti.opts.direction === 'back'; |
| 654 | |
| 655 | /** |
| 656 | * If heading back, use the entering page's animation |
| 657 | * unless otherwise specified by the developer. |
| 658 | */ |
| 659 | if (isBackDirection) { |
| 660 | ti.opts.animationBuilder = ti.opts.animationBuilder || enteringView?.animationBuilder; |
| 661 | } |
| 662 | |
| 663 | leavingView.animationBuilder = ti.opts.animationBuilder; |
| 664 | } |
| 665 | let result: NavResult; |
| 666 | if (requiresTransition) { |
| 667 | result = await this.transition(enteringView!, leavingView, ti); |
| 668 | } else { |
| 669 | // transition is not required, so we are already done! |
| 670 | // they're inserting/removing the views somewhere in the middle or |
| 671 | // beginning, so visually nothing needs to animate/transition |
| 672 | // resolve immediately because there's no animation that's happening |
| 673 | result = { |
| 674 | hasCompleted: true, |
| 675 | requiresTransition: false, |
| 676 | }; |
| 677 | } |
| 678 | |
| 679 | this.success(result, ti); |
| 680 | this.ionNavDidChange.emit(); |
| 681 | } catch (rejectReason) { |
| 682 | this.failed(rejectReason, ti); |
| 683 | } |
| 684 | this.isTransitioning = false; |
| 685 | this.nextTrns(); |
| 686 | } |
| 687 |
no test coverage detected