ionic-team / ionic-team/ionic-framework

feat: ion-nav / ion-router: ability to swap current view

Aperta
#21,316 13 commenti 4 reazioni 0 assegnatari Vedi su GitHub
package: core type: feature request
Lingua principale
TypeScript
Stelle
52.7k
Fork
13.3k
Merge medio
1g 15h
PR unite (30g)
51

Descrizione

# Feature Request

**Ionic version:**
[x] **5.1.0**

**Describe the Feature Request**

Currently there is not a way to swap the current view in the navigation stack vs. pushing or popping.

For example, a simple contact management app might use a route '/contacts/:contactId'.

If the app provides a `Next` button then it is not clear how to show the next contact with the appropriate url while avoiding continuing to push new views onto the navigation stack.

Currently it keeps adding new views to the stack so the user experience would be:
- click on contact A
- click `next` to show contact B
- click `next` to show contact C
- now all the views are in the stack and the user needs to back through all of them

Swapping views in the stack is common for many mobile apps (email, contacts, etc.)

**Describe Preferred Solution**

One possible approach would be to add `swap` to the values for `RouterDirection`. This could then be passed to `ion-nav` so it could swap the view vs. pushing a new view onto the stack.

`ion-nav` could also be updated to expose a `swap` method.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.