question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

3.2.0 Breaking Change: Drag Callbacks

See original GitHub issue

It appears there was an inadvertent breaking change in 3.2.0 relating to https://github.com/mzabriskie/react-draggable/pull/361.

Prior to 3.2.0, if a defaultPosition were present, it became the x and y present in the callback on the initial drag and subsequent to that.

In 3.2.0, the x and y received in the callback is relative to the defaultPosition already passed. So if you pass a defaultPosition of x: 100, y:100and initiateonDragStart, the callback will contain {x: 0, y: 0}in the data. This makes sense if you considerdefaultPositionto be something more likeinitialOffset, and is required if your offset is something like, for example, {x: '10%', y: '10%'}.

Ref: https://github.com/bokuweb/react-rnd/issues/437 and a broken build at https://circleci.com/gh/bokuweb/react-rnd/1340.

Next Steps

Our choices:

  • Is there a way to keep the old “absolute” offsets in callbacks from <= 3.1.1?
    • Percentage offsets will make this very difficult
  • Release a major version instead?
  • Drop the feature? A percentage-based default position can also be achieved by wrapping the <Draggable> in a div with a transform: translate(10%, 10%).

Ping @tnrich.

I’ve pulled 3.2.0 from npm and will be releasing a 3.2.1 with just the TS export fix.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
STRMLcommented, Mar 2, 2019

I think a new param works, perhaps positionOffset - makes it clear that you’re not pre-setting the state to something like {x: 100, y: 100}, you’re offsetting the whole thing by some number or percentage and it doesn’t actually affect the internal state and doesn’t show up in callbacks.

1reaction
tnrichcommented, Mar 8, 2019

I’ve PR’d a first pass at doing this: https://github.com/mzabriskie/react-draggable/pull/393

Read more comments on GitHub >

github_iconTop Results From Across the Web

3.2.0 Breaking Change: Drag Callbacks · Issue #391 - GitHub
It appears there was an inadvertent breaking change in 3.2.0 relating to #361. Prior to 3.2.0, if a defaultPosition were present, ...
Read more >
https://raw.githubusercontent.com/toddmyphoto/reac...
~3.2.0 (Feb 27, 2019)~ > Note: this release has been pulled due to an ... breaking change: bounds are calculated before `<Draggable>` fires...
Read more >
SOAP Callback Operations - Rocket Software Documentation
SOAP callback operations are pre-defined operations that are called before or after a SOAP request is handled for web services call-in or call-out....
Read more >
Changelog - Cypress Documentation
Experimental Breaking Changes:​​ session() will no longer fail validation when false is returned from the validate callback. Fixes #21398, #24205, and #24593.
Read more >
Swiper Changelog
Added new onAny(callback) listener to listen for any swiper event. All events now emit swiper instance as a first argument (BREAKING CHANGE).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found