ionic-team / ionic-team/ionic-framework

feat: Add event for ion-item-sliding open/close state change

Đang mở
#18,533 2 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] **4.x**

**Describe the Feature Request**

Ionic should provide an event(s) for developers that allows them to determine when an `` has been fully opened or closed.

**Describe Preferred Solution**

Provide event(s) `ionOpen` and/or `ionClose` emitted when the slider reaches a fully open or closed position. It would only emit once even if the user has not removed their finger from the slider, but the slider has moved to an "open/closed" position.

For example, if the user moves the slider from position 0 to position 1.0, the event would fire once.

If the user moves the slider from position 0 -> 1 and back to 0, the event would fire twice (once on "open" and once on "close").

If the user moves the slider from position 0 -> 0.5 -> 0, the event would *not* fire (because there was not a change from open to closed or vice-versa.

**Describe Alternatives**

The current implementation allows developers to use the `ionDrag` event (https://ionicframework.com/docs/api/item-sliding#events), but that event emits any time the position changes and is not definitive (i.e. you could drag a slider halfway to open/closed and the event would still fire).

Alternatively you could also use the `getSlidingRatio` and set it to a specific value. However, this is also not definitive as you could drag from 0 -> 0.75 -> 0 which should not count as a close/open.

**Related Code**

I do not have a code sample at this time.

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

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

Đánh giá

Issue này chưa được đánh giá.

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.