mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 03:00:58 +08:00
fix(angular): no animate in browser nav
This commit is contained in:

committed by
Manu MA

parent
194667c62a
commit
276c883493
@ -10,7 +10,8 @@ export class NavController {
|
|||||||
|
|
||||||
private direction: NavDirection = DEFAULT_DIRECTION;
|
private direction: NavDirection = DEFAULT_DIRECTION;
|
||||||
private animated = DEFAULT_ANIMATED;
|
private animated = DEFAULT_ANIMATED;
|
||||||
private guessDirection: NavDirection = 'root';
|
private guessDirection: NavDirection = 'forward';
|
||||||
|
private guessAnimation = false;
|
||||||
private lastNavId = -1;
|
private lastNavId = -1;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@ -22,6 +23,7 @@ export class NavController {
|
|||||||
router.events.subscribe(ev => {
|
router.events.subscribe(ev => {
|
||||||
if (ev instanceof NavigationStart) {
|
if (ev instanceof NavigationStart) {
|
||||||
const id = (ev.restoredState) ? ev.restoredState.navigationId : ev.id;
|
const id = (ev.restoredState) ? ev.restoredState.navigationId : ev.id;
|
||||||
|
this.guessAnimation = !ev.restoredState;
|
||||||
this.guessDirection = id < this.lastNavId ? 'back' : 'forward';
|
this.guessDirection = id < this.lastNavId ? 'back' : 'forward';
|
||||||
this.lastNavId = this.guessDirection === 'forward' ? ev.id : id;
|
this.lastNavId = this.guessDirection === 'forward' ? ev.id : id;
|
||||||
}
|
}
|
||||||
@ -77,8 +79,8 @@ export class NavController {
|
|||||||
|
|
||||||
if (this.direction === 'auto') {
|
if (this.direction === 'auto') {
|
||||||
direction = this.guessDirection;
|
direction = this.guessDirection;
|
||||||
console.log('guessed', direction);
|
animated = this.guessAnimation;
|
||||||
animated = direction !== 'root';
|
console.debug('[nav-controller] guessed nav direction', direction, 'animated', animated);
|
||||||
} else {
|
} else {
|
||||||
animated = this.animated;
|
animated = this.animated;
|
||||||
direction = this.direction;
|
direction = this.direction;
|
||||||
|
@ -32,7 +32,12 @@ describe('router-link', () => {
|
|||||||
await testForward();
|
await testForward();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should go forward with button + navigateForward', async () => {
|
it('should go forward with button + navigateByUrl()', async () => {
|
||||||
|
await element(by.css('#button')).click();
|
||||||
|
await testForward();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should go forward with button + navigateForward()', async () => {
|
||||||
await element(by.css('#button-forward')).click();
|
await element(by.css('#button-forward')).click();
|
||||||
await testForward();
|
await testForward();
|
||||||
});
|
});
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
# Build core
|
|
||||||
pushd ../../..
|
pushd ../../..
|
||||||
|
|
||||||
|
# Build core
|
||||||
pushd core
|
pushd core
|
||||||
npm run build
|
npm run build
|
||||||
npm run link
|
npm link
|
||||||
popd
|
popd
|
||||||
|
|
||||||
|
# Build angular
|
||||||
pushd angular
|
pushd angular
|
||||||
npm link @ionic/core
|
npm link @ionic/core
|
||||||
npm run build
|
npm run build
|
||||||
|
Reference in New Issue
Block a user