Skip to content

Conversation

@chrisstiles
Copy link
Contributor

Proposed solution

Fixes new issue related to #707

In strict mode, react warns that React-Draggable's usage of ReactDOM.findDOMNode() is deprecated. Passing the nodeRef prop to <Rnd /> silences the error, but causes dragging to become jittery. This is because React-Draggable expects the nodeRef to reference its top level child, which is actually the <div> rendered by re-resizable.

Instead of allowing a nodeRef to be passed to react-rnd, we can pass the resizable ref using Rnd.prototype.getSelfElement(). Since React-Draggable expects a ref object, it is passed as the current value of an object like this:

This PR also removes documentation from the react-rnd README.md that references allowing users to pass nodeRef.

<Draggable
  ...
  nodeRef={{ current: this.getSelfElement() }}
>

Tradeoffs

React-Draggable still works if we don't pass it the resizable ref, but React will log a big deprecation warning.

Testing Done

All storybooks still worked and all tests passed.

@bokuweb bokuweb merged commit d1181d5 into bokuweb:master Jul 27, 2020
@bokuweb
Copy link
Owner

bokuweb commented Jul 27, 2020

@chrisstiles Thanks :) 10.2.1 published 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants