Skip to content

deltaX and deltaY are always 0 in onDragStop #978

@MOhhh-ok

Description

@MOhhh-ok

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

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions