@@ -50,6 +50,7 @@ type SortableTableContextInfo = {
50
50
highlightHandle : HighlightHandle < ShouldBeValue > ;
51
51
renderRow : ( props : RenderRowProps ) => ReactNode ;
52
52
row : string ; //Row<ShouldBeValue>;
53
+ rows : ShouldBeValue [ ] ;
53
54
rowClassName : string ; // RowClassName<ShouldBeValue> | undefined;
54
55
rowLabels : string [ ] | undefined ;
55
56
tableRef : string ; //RefObject<HTMLTableElement | null>;
@@ -311,8 +312,9 @@ export const SortableContextWrappers = ({
311
312
rowClassName : "???" ,
312
313
rowLabels : undefined ,
313
314
tableRef : "???" ,
315
+ rows,
314
316
} ) ,
315
- [ clickedIndex , draggedIndex , highlightHandle , renderRow ] ,
317
+ [ clickedIndex , draggedIndex , highlightHandle , renderRow , rows ] ,
316
318
) ;
317
319
318
320
// string rather than string | number because 0 as an ID doesn't work, and that's more likely than an empty string!
@@ -392,12 +394,18 @@ export const SortableContextWrappers = ({
392
394
} ;
393
395
394
396
export const MyDragOverlay = ( ) => {
395
- const { draggedIndex, row } = useContext ( SortableTableContext ) ;
397
+ const { draggedIndex, renderRow , rows } = useContext ( SortableTableContext ) ;
396
398
397
- console . log ( "MyDragOverlay" , draggedIndex , row ) ;
398
399
return (
399
400
< DragOverlay wrapperElement = "tbody" >
400
- { draggedIndex !== undefined ? < div > HELLO!</ div > : null }
401
+ { draggedIndex !== undefined
402
+ ? renderRow ( {
403
+ draggedIndex,
404
+ index : draggedIndex ,
405
+ overlay : true ,
406
+ value : rows [ draggedIndex ] ,
407
+ } )
408
+ : null }
401
409
</ DragOverlay >
402
410
) ;
403
411
} ;
0 commit comments