bokuweb/react-rnd

onDragStop x value doesn't respect dragGrid

citripio opened this issue · 2 comments

Here's a demo: https://codesandbox.io/s/magical-rui-oem7n?file=/src/index.js

With a dragGrid of, say, [50,50], the draggable element moves along the grid but the x value returned at onDragStop changes freely, when it should always be a multiple of 50.

Is this a bug, or is there another (correct) way to get how many steps the element has moved?

It seems to be an issue in react-draggable.
The fix was merged but not released yet.

Hi, is there any update on this?

In the meantime, I've found that updating react-dnd's react-draggable dependency to the latest (4.4.5) solves this specific issue

https://codesandbox.io/s/react-dnd-bug-9lffyt?file=/src/index.js:523-610