ionic-team / ionic-team/ionic-framework
bug: vue, custom replace animation is not used
- Lingua principale
- TypeScript
- Stelle
- 52.7k
- Fork
- 13.3k
- Merge medio
- 1g 15h
- PR unite (30g)
- 51
Descrizione
### Prerequisites
- [X] I have read the [Contributing Guidelines](https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#creating-an-issue).
- [X] I agree to follow the [Code of Conduct](https://ionicframework.com/code-of-conduct).
- [X] I have searched for [existing issues](https://github.com/ionic-team/ionic-framework/issues) that already report this problem, without success.
### Ionic Framework Version
v7.x
### Current Behavior
When a statement like `ionRouter.navigate("detail/", "back", "replace", animationBuilder1);` is executed on a page that was presented using a custom animation, the custom animation from the `ioRouter.navigate` statement is ignored and the animation that was used when the page was created is used instead.
### Expected Behavior
Whenever a custom animation is included on a `ionRouter.navigate` statement the custom navigation should be executed regardless of whether are not a custom animation was included when the calling page was created.
Snooping around the ionic source code I found the following in `ion-router-outlet.ts`:
```
/**
* If we are going back from a page that
* was presented using a custom animation
* we should default to using that
* unless the developer explicitly
* provided another animation.
*/
const customAnimation = enteringViewItem.routerAnimation;
if (animationBuilder === undefined && customAnimation !== undefined) {
animationBuilder = customAnimation;
}
leavingViewItem.routerAnimation = animationBuilder;
```
So it appears that the issue that I described was attempted to be addressed, but is not working.
### Steps to Reproduce
1. Open the stackblitz code reproduction url
2. On the Master Page click the top "Go To Detail Page 1" button
Notice that the transition is a sliding page left (iosTransitionAnimation), which is correct.
3. On Detail Page 1 click the "Go ToDetail Page 2" button
Notice that the animation that is used to go to "Detail Page 2" is the same slide page left animation that was used when going from the "Master Page" to "Detail Page 1." This is incorrect since the ionRouter statement used on "Detail Page 1" contains the `animationBuilder1` custom animation.
if you go back to the "Master Page" and click on the green "Go To Detail Page 1" button which results in an ionRouter.push statement with no custom animation and then when on "Detail Page 1" click on the "Go ToDetail Page 2" button you will see that the correct animation is used when going from "Detail Page 1" to "Detail Page 2".
### Code Reproduction URL
https://stackblitz.com/edit/github-rg4p6g-mqsf9p
https://github.com/mmoore99/ionic-vue-page-transition-test
### Ionic Info
@Ionic vue = 7.1.0
@Ionic vue-router 7.1.0
vue 3.3.4
vue-router 4.2.2
### Additional Information
if you could point me in the direction of locating where in the code the cusom animation is being changed when using ionRouter.navigate with "replace" I would see if I could submit a PR with a fix.
Guida per i contributori
Apri la guida per i contributori
Valutazione
Questa issue non è ancora stata valutata.