Skip to content

Commit d1181d5

Browse files
authored
Fix #707: passing nodeRef prop causes dragging to become jittery (#718)
* Pass resizable ref as nodeRef (#707) * Remove nodeRef (#707)
1 parent 6dced8b commit d1181d5

File tree

2 files changed

+1
-21
lines changed

2 files changed

+1
-21
lines changed

README.md

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -498,26 +498,6 @@ class YourComponent extends Component {
498498

499499
If set to `true`, will allow dragging on non left-button clicks.
500500

501-
#### `nodeRef?: React.Ref<typeof React.Component>`
502-
503-
please see, https://github.com/STRML/react-draggable
504-
```
505-
If running in React Strict mode, ReactDOM.findDOMNode() is deprecated.
506-
Unfortunately, in order for <Draggable> to work properly, we need raw access
507-
to the underlying DOM node. If you want to avoid the warning, pass a `nodeRef`
508-
as in this example:
509-
510-
function MyComponent() {
511-
const nodeRef = React.useRef(null);
512-
return (
513-
<Rnd nodeRef={nodeRef}>
514-
<div ref={nodeRef}>Example Target</div>
515-
</Rnd>
516-
);
517-
}
518-
519-
```
520-
521501
## Test
522502

523503
``` sh

src/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ export class Rnd extends React.PureComponent<Props, State> {
626626
cancel={cancel}
627627
scale={scale}
628628
allowAnyClick={allowAnyClick}
629-
nodeRef={nodeRef}
629+
nodeRef={{ current: this.getSelfElement() }}
630630
>
631631
<Resizable
632632
{...resizableProps}

0 commit comments

Comments
 (0)