FormidableLabs / react-swipeable

React swipe event handler hook
https://commerce.nearform.com/open-source/react-swipeable
MIT License
1.99k stars 146 forks source link

Expose swipe start? #222

Closed feketegy closed 3 years ago

feketegy commented 3 years ago

Why not expose the touchStart / mouseDown events so users can separate out the very first swipe, instead of connecting it to the onSwiping event's first property?

hartzis commented 3 years ago

@feketegy sensible question, 🤔 . I'm curious what that could look like.

Any thoughts or ideas?

feketegy commented 3 years ago

@hartzis My specific use case would be to set up some states on the very first swipe event, I'm using your package more like a dragging & dropping library :)

This is why I was relying on the first property being true, but it has this bug: https://github.com/FormidableLabs/react-swipeable/issues/221

I think it would be cleaner this way to expose an onSwipeStart event rather to rely on the first property in the onSwiping callback.

Great package btw 👍

hartzis commented 3 years ago

@feketegy Great suggestion. I think onSwipeStart is simple and small enough to introduce.

Thoughts on #226 as a solution?

feketegy commented 3 years ago

I totally missed this, awesome addition, thanks for this!