marekrozmus / react-swipeable-list

Swipeable list component for React supporting several behaviours (e.g. iOS)
https://marekrozmus.github.io/react-swipeable-list/
MIT License
110 stars 20 forks source link

onSwipeStart only called once per element #39

Open arondeparon opened 1 year ago

arondeparon commented 1 year ago

Describe the bug When using a trailing and leading action on a single element, onSwipeStart will only be called once.

To Reproduce Steps to reproduce the behavior:

  1. Partially swipe right.
  2. Observe that onSwipeStart will trigger
  3. End swipe.
  4. Partially swipe left.
  5. Oberse that onSwipeStart will NOT trigger.

Expected behavior onSwipeStart should trigger every time a new sequence is started.

Note: it does work when swiping on another SwipableListItem and afterwards returning to the original element.

marekrozmus commented 1 year ago

Hi @ArondeParon - what do you mean in point 3? Do you release the click/touch or not?

I have tried here: https://marekrozmus.github.io/react-swipeable-list/ and when I go like this:

  1. Partially swipe right.
  2. onSwipeStart triggers
  3. End swipe (release the mouse or touch)
  4. Partially swipe left.
  5. onSwipeStart triggers.
arondeparon commented 1 year ago

@marekrozmus the issue seems to occur only when swiping from a "locked" state (not sure what you call it?) to another "locked" state. It's a bit hard to describe, so I recorded a video showing the behavior.

https://github.com/marekrozmus/react-swipeable-list/assets/7697/31635a5e-54b0-46e6-be17-6ab14e945565

marekrozmus commented 1 year ago

Hi @ArondeParon - what kind of case you need that specific behaviour? I mean now it works that swipe start is triggered when user moves item beyond the threshold and the swipe end when user release mouse button. If you enter the "locked" state you are still "inside the swipe" state. I think that what we are missing here is the scenario when user is swiping from "locked" state in opposite direction. Then it should go through initial state and then new swipe start with opposite direction should be triggered?