-
-
Notifications
You must be signed in to change notification settings - Fork 334
Open
Description
Description
In the onDragStop callback, deltaX and deltaY are always 0, even though the TypeScript types indicate they should contain the delta values.
Reproduction
<Rnd
default={{
x: 0,
y: 0,
width: 200,
height: 100,
}}
onDragStop={(e, { x, y, deltaX, deltaY }) => {
console.log({ x, y, deltaX, deltaY });
// deltaX and deltaY are always 0
}}
>
Content
</Rnd>Expected Behavior
deltaX and deltaY should contain the difference from the previous position.
Actual Behavior
deltaX and deltaY are always 0 in onDragStop.
Workaround
Use onDrag instead of onDragStop to get the delta values.
Suggestion
Either fix the implementation or update the documentation/types to clarify that deltaX and deltaY are not available in onDragStop.
Environment
- react-rnd: 10.5.2
- React: 19.2.0
Metadata
Metadata
Assignees
Labels
No labels