ionic-team / ionic-team/ionic-framework

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

Đang mở
#21,316 13 bình luận 4 reaction 0 người được giao Xem trên GitHub
package: core type: feature request
Ngôn ngữ chính
TypeScript
Star
52.7k
Fork
13.3k
Merge trung bình
1 ngày 15 giờ
Pull request đã merge (30 ngày)
51

Mô tả

# 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.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Start by reviewing the ion-nav and ion-router navigation APIs, especially RouterDirection and the existing push/pop behavior. Define the expected swap behavior for the contact route example and verify that replacing the current view avoids accumulating entries in the navigation stack.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
typescript
Lĩnh vực
frontend, mobile
Loại issue
Tính năng
Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
25/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.