Skip to content

Commit

Permalink
[docs][material-ui] Fix crashing of DraggableDialog demo (#44811)
Browse files Browse the repository at this point in the history
  • Loading branch information
sai6855 authored Dec 24, 2024
1 parent a37b3d4 commit 0f4e27d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion docs/data/material/components/dialogs/DraggableDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@ import Paper from '@mui/material/Paper';
import Draggable from 'react-draggable';

function PaperComponent(props) {
const nodeRef = React.useRef(null);
return (
<Draggable
nodeRef={nodeRef}
handle="#draggable-dialog-title"
cancel={'[class*="MuiDialogContent-root"]'}
>
<Paper {...props} />
<Paper {...props} ref={nodeRef} />
</Draggable>
);
}
Expand Down
4 changes: 3 additions & 1 deletion docs/data/material/components/dialogs/DraggableDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@ import Paper, { PaperProps } from '@mui/material/Paper';
import Draggable from 'react-draggable';

function PaperComponent(props: PaperProps) {
const nodeRef = React.useRef<HTMLDivElement>(null);
return (
<Draggable
nodeRef={nodeRef as React.RefObject<HTMLDivElement>}
handle="#draggable-dialog-title"
cancel={'[class*="MuiDialogContent-root"]'}
>
<Paper {...props} />
<Paper {...props} ref={nodeRef} />
</Draggable>
);
}
Expand Down

0 comments on commit 0f4e27d

Please sign in to comment.