minwork / use-long-press

React hook for detecting click (or tap) and hold event
MIT License
122 stars 12 forks source link

Scrolling with touch still triggers long-press #6

Closed Alexsutton14 closed 3 years ago

Alexsutton14 commented 3 years ago

This may be intentional behaviour but if there are a lot of use-long-press elements on screen, and a user happens to start a touch on one of them to scroll the long press event still triggers even when scrolling. Should onTouchMove events cancel long-presses?

I've tried adding the handlers to my fork, which seems to work although would be a breaking change for any existing uses where being able to move whilst touching is required.

vatson commented 3 years ago

@Alexsutton14 thanks for your workaround. It works fine for me. By the way, react-use has the same issue.

minwork commented 3 years ago

Thanks @Alexsutton14 for discovering that case. I have solution in mind so it will be addressed in the next minor version.

minwork commented 3 years ago

This issue will be solved by https://github.com/minwork/use-long-press/pull/8

github-actions[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.