ionic-team / ionic-team/ionic-framework
feat: Add event for ion-item-sliding open/close state change
- Langage dominant
- TypeScript
- Étoiles
- 52.7k
- Forks
- 13.3k
- Merge moyen
- 1 j 15 h
- PR mergées (30 j)
- 51
Description
# 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.
Guide de contribution
Ouvrir le guide de contribution
Évaluation
Cette issue n'a pas encore été évaluée.