ionic-team / ionic-team/ionic-framework

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

Abierto
#18,533 2 comentarios 4 reacciones 0 asignados Ver en GitHub
package: core type: feature request
Lenguaje dominante
TypeScript
Estrellas
52.7k
Forks
13.3k
Merge medio
1 d 15 h
PR fusionados (30 d)
51

Descripción

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

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.