ui: fix dnd

This commit is contained in:
undefined committed 2022-04-06 14:14:03 +08:00
1 parent 406e45975f
commit ce5a16914c
5 files changed
+9 -9

No files matched your search

@@ -58,16 +58,16 @@ function DraggableSelection({
type, id, move, children, ...props
}) {
const ref = useRef<HTMLDivElement>(null);
const [isDragging, drag] = useDrag<string, any, boolean>(() => ({
const [isDragging, drag] = useDrag<{ id: string }, any, boolean>(() => ({
type,
item: id,
item: { id },
collect: (m) => m.isDragging(),
}));
const [, drop] = useDrop({
accept: type,
hover: (item: string) => {
hover: (item: { id: string }) => {
if (!ref.current) return;
move(item, id);
move(item.id, id);
},
});
drag(drop(ref));