Set isDragging to false when dragging ends
This commit is contained in:
parent
aed1882165
commit
8f659eb975
@ -24,6 +24,7 @@ export default function TableInfo({ data }) {
|
||||
const [editField, setEditField] = useState({});
|
||||
const draggingElementIndex = useRef();
|
||||
const isDragging = useRef();
|
||||
console.log(isDragging.current);
|
||||
|
||||
return (
|
||||
<div>
|
||||
@ -62,6 +63,7 @@ export default function TableInfo({ data }) {
|
||||
onDragOver={(e) => {
|
||||
e.preventDefault();
|
||||
if (isDragging.current) return;
|
||||
console.log("dragging over...");
|
||||
isDragging.current = true;
|
||||
draggingElementIndex.current = j;
|
||||
}}
|
||||
@ -80,6 +82,10 @@ export default function TableInfo({ data }) {
|
||||
updateField(data.id, index, { ...b, id: index });
|
||||
updateField(data.id, j, { ...a, id: j });
|
||||
}}
|
||||
onDragEnd={(e) => {
|
||||
e.preventDefault();
|
||||
isDragging.current = false;
|
||||
}}
|
||||
>
|
||||
<TableField data={f} tid={data.id} index={j} />
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user