File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed
Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -48,6 +48,7 @@ declare module 'react-draggable' {
4848 offsetParent : HTMLElement ,
4949 grid : [ number , number ] ,
5050 handle : string ,
51+ nodeRef ?: React . RefObject < HTMLElement > ,
5152 onStart : DraggableEventHandler ,
5253 onDrag : DraggableEventHandler ,
5354 onStop : DraggableEventHandler ,
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ function handleDrag() {}
99function handleStop ( ) { }
1010function handleMouseDown ( ) { }
1111
12+ const nodeRef = React . createRef < HTMLDivElement > ( ) ;
1213ReactDOM . render (
1314 < Draggable
1415 axis = "y"
@@ -28,16 +29,18 @@ ReactDOM.render(
2829 defaultClassNameDragging = { 'dragging' }
2930 defaultClassNameDragged = { 'dragged' }
3031 defaultPosition = { { x : 0 , y : 0 } }
32+ nodeRef = { nodeRef }
3133 positionOffset = { { x : 0 , y : 0 } }
3234 position = { { x : 50 , y : 50 } } >
33- < div className = "foo bar" >
35+ < div className = "foo bar" ref = { nodeRef } >
3436 < div className = "handle" />
3537 < div className = "cancel" />
3638 </ div >
3739 </ Draggable > ,
3840 root
3941) ;
4042
43+ const nodeRefCore = React . createRef < HTMLDivElement > ( ) ;
4144ReactDOM . render (
4245 < DraggableCore
4346 handle = ".handle"
@@ -46,12 +49,13 @@ ReactDOM.render(
4649 disabled = { true }
4750 onMouseDown = { handleMouseDown }
4851 grid = { [ 10 , 10 ] }
52+ nodeRef = { nodeRefCore }
4953 onStart = { handleStart }
5054 onDrag = { handleDrag }
5155 onStop = { handleStop }
5256 offsetParent = { document . body }
5357 enableUserSelectHack = { false } >
54- < div className = "foo bar" >
58+ < div className = "foo bar" ref = { nodeRefCore } >
5559 < div className = "handle" />
5660 < div className = "cancel" />
5761 </ div >
You can’t perform that action at this time.
0 commit comments