react-grid-layout: `onDragStart` triggered on item click but `onDragEnd` Doesn't
When implementing the onDragStart and onDragEnd. A click on an item (not an actual drag) would trigger onDragStart but doesn’t trigger onDragEnd.
Please check this gif

I am not sure if the fix here would require not triggering onDragStart on click or triggering onDragEnd after the click is done.
reproduce steps
1- https://codesandbox.io/s/zealous-drake-q3ube?file=/src/ShowcaseLayout.js:1923-1932 2- click on an item and check the logs
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 7
- Comments: 15
As stated in my previous comment, there is an actual bug here, regardless of the decision behind the callback issue in the title.
I found this due to the same problem, however I think the solution is a lot easier than above.
This is way clearer than what I was doing, thanks!
Nice. I came to a similar workaround, just using
onDragandonDragStop. In my case, I’m using it to prevent clicks on links when dragging so a user doesn’t accidentally open a link when they are trying to rearrange the grid.Declare
isDraggingstateconst [isDragging, setIsDragging] = useState(false);Create handlers for
onDragandonDragStop. Conditional inhandleDragis to ensure it is not called continuallyuseEffectto do the work