mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
feat(angular): expose animationDirection (#16802)
* feat(angular): expose animationDirection * update
This commit is contained in:
@@ -64,6 +64,6 @@ export class IonTabs {
|
||||
? href
|
||||
: this.outlet.getLastUrl(tab) || href;
|
||||
|
||||
return this.navCtrl.navigateBack(url, true);
|
||||
return this.navCtrl.navigateBack(url);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import { LocationStrategy } from '@angular/common';
|
||||
import { Directive, ElementRef, HostListener, Input, Optional } from '@angular/core';
|
||||
import { Router, RouterLink } from '@angular/router';
|
||||
import { RouterDirection } from '@ionic/core';
|
||||
import { Subscription } from 'rxjs';
|
||||
|
||||
import { NavController, NavDirection } from '../../providers/nav-controller';
|
||||
import { NavController } from '../../providers/nav-controller';
|
||||
|
||||
@Directive({
|
||||
selector: '[routerLink]',
|
||||
@@ -12,7 +13,7 @@ export class RouterLinkDelegate {
|
||||
|
||||
private subscription?: Subscription;
|
||||
|
||||
@Input() routerDirection: NavDirection = 'forward';
|
||||
@Input() routerDirection: RouterDirection = 'forward';
|
||||
|
||||
constructor(
|
||||
private locationStrategy: LocationStrategy,
|
||||
|
||||
@@ -2,7 +2,7 @@ import { ComponentRef, NgZone } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { RouterDirection } from '@ionic/core';
|
||||
|
||||
import { NavController, NavDirection } from '../../providers/nav-controller';
|
||||
import { NavController } from '../../providers/nav-controller';
|
||||
|
||||
import { RouteView, computeStackId, destroyView, getUrl, insertView, isTabSwitch, toSegments } from './stack-utils';
|
||||
|
||||
@@ -43,14 +43,14 @@ export class StackController {
|
||||
}
|
||||
|
||||
async setActive(enteringView: RouteView) {
|
||||
let { direction, animated } = this.navCtrl.consumeTransition();
|
||||
let { direction, animation } = this.navCtrl.consumeTransition();
|
||||
const leavingView = this.activeView;
|
||||
if (isTabSwitch(enteringView, leavingView)) {
|
||||
direction = 'back';
|
||||
animated = false;
|
||||
animation = undefined;
|
||||
}
|
||||
this.insertView(enteringView, direction);
|
||||
await this.transition(enteringView, leavingView, direction, animated, this.canGoBack(1), false);
|
||||
await this.transition(enteringView, leavingView, animation, this.canGoBack(1), false);
|
||||
this.cleanup();
|
||||
}
|
||||
|
||||
@@ -73,7 +73,6 @@ export class StackController {
|
||||
views[views.length - 1], // leaving view
|
||||
'back',
|
||||
true,
|
||||
true,
|
||||
true
|
||||
);
|
||||
}
|
||||
@@ -130,8 +129,7 @@ export class StackController {
|
||||
private async transition(
|
||||
enteringView: RouteView | undefined,
|
||||
leavingView: RouteView | undefined,
|
||||
direction: NavDirection,
|
||||
animated: boolean,
|
||||
direction: 'forward' | 'back' | undefined,
|
||||
showGoBack: boolean,
|
||||
progressAnimation: boolean
|
||||
) {
|
||||
@@ -159,9 +157,9 @@ export class StackController {
|
||||
|
||||
await containerEl.componentOnReady();
|
||||
this.runningTransition = containerEl.commit(enteringEl, leavingEl, {
|
||||
duration: !animated ? 0 : undefined,
|
||||
direction: direction === 'forward' ? 'forward' : 'back', // TODO: refactor
|
||||
deepWait: true,
|
||||
duration: direction === undefined ? 0 : undefined,
|
||||
direction,
|
||||
showGoBack,
|
||||
progressAnimation
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user