react-draggable
react-draggable copied to clipboard
Delay for touch events
Is there a way to set delay for touch events, so that dragging started after N ms of touching (to differentiate from tapping and scrolling)?
you can get lastX and lastY from as the second argument in the onDrag and calculate the difference and set a value in state to disable drag after that movement enable the drag
Is there any plan for this issue? I think it would be great to have this feature embeded in component instead of manually having to compare onDrag arguments on touchDevices
this worked for me
https://codesandbox.io/s/eager-darkness-j97pd
You can use something like useLongPress to enable dragging. You can't use the disabled prop but you can return false in the onDrag handler.
这个问题有解决方案吗?使用 @carloquilala 的答案可以在 onStop 函数内部拦截到点击事件,但是并不会出发节点本身的onClick事件