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
Description
In the
onDragStopcallback,deltaXanddeltaYare always 0, even though the TypeScript types indicate they should contain the delta values.Reproduction
Expected Behavior
deltaXanddeltaYshould contain the difference from the previous position.Actual Behavior
deltaXanddeltaYare always 0 inonDragStop.Workaround
Use
onDraginstead ofonDragStopto get the delta values.Suggestion
Either fix the implementation or update the documentation/types to clarify that
deltaXanddeltaYare not available inonDragStop.Environment