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 animated = DEFAULT_ANIMATED;
|
||||
private guessDirection: NavDirection = 'root';
|
||||
private guessDirection: NavDirection = 'forward';
|
||||
private guessAnimation = false;
|
||||
private lastNavId = -1;
|
||||
|
||||
constructor(
|
||||
@ -22,6 +23,7 @@ export class NavController {
|
||||
router.events.subscribe(ev => {
|
||||
if (ev instanceof NavigationStart) {
|
||||
const id = (ev.restoredState) ? ev.restoredState.navigationId : ev.id;
|
||||
this.guessAnimation = !ev.restoredState;
|
||||
this.guessDirection = id < this.lastNavId ? 'back' : 'forward';
|
||||
this.lastNavId = this.guessDirection === 'forward' ? ev.id : id;
|
||||
}
|
||||
@ -77,8 +79,8 @@ export class NavController {
|
||||
|
||||
if (this.direction === 'auto') {
|
||||
direction = this.guessDirection;
|
||||
console.log('guessed', direction);
|
||||
animated = direction !== 'root';
|
||||
animated = this.guessAnimation;
|
||||
console.debug('[nav-controller] guessed nav direction', direction, 'animated', animated);
|
||||
} else {
|
||||
animated = this.animated;
|
||||
direction = this.direction;
|
||||
|
@ -32,7 +32,12 @@ describe('router-link', () => {
|
||||
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 testForward();
|
||||
});
|
||||
|
@ -1,11 +1,12 @@
|
||||
# Build core
|
||||
pushd ../../..
|
||||
|
||||
# Build core
|
||||
pushd core
|
||||
npm run build
|
||||
npm run link
|
||||
npm link
|
||||
popd
|
||||
|
||||
# Build angular
|
||||
pushd angular
|
||||
npm link @ionic/core
|
||||
npm run build
|
||||
|
Reference in New Issue
Block a user