Skip to content

Commit

Permalink
ColumnsEditorTab: Use nodeRef for Draggable
Browse files Browse the repository at this point in the history
According to react-grid-layout/react-draggable#749 (comment) and https://github.com/react-grid-layout/react-draggable?tab=readme-ov-file#draggable-props this is a workaround to avoid the following warning:

```
Warning: findDOMNode is deprecated and will be removed in the next major release. Instead, add a ref directly to the element you want to reference. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-find-node
```
  • Loading branch information
apepper committed Sep 23, 2024
1 parent 5b7b278 commit 7df9d4f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Widgets/ColumnContainerWidget/ColumnsEditorTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,7 @@ class GridLayoutEditor extends Component<
if (nextColSize) {
const leftBound = -(colSize - 1)
const rightBound = nextColSize - 1
const nodeRef = createRef<HTMLDivElement>()

innerContent.unshift(
<Draggable
Expand All @@ -521,8 +522,12 @@ class GridLayoutEditor extends Component<
deltaColSize: Math.round(x / this.state.draggableGrid),
})
}
nodeRef={nodeRef}
>
<div className={this.props.readOnly ? '' : 'grid-handle'} />
<div
ref={nodeRef}
className={this.props.readOnly ? '' : 'grid-handle'}
/>
</Draggable>,
)
} else if (colIndex < 5 && !this.props.readOnly) {
Expand Down

0 comments on commit 7df9d4f

Please sign in to comment.