diff --git a/components/table/demo/drag-sorting.tsx b/components/table/demo/drag-sorting.tsx index f6d9269759..e5e11ce1d1 100644 --- a/components/table/demo/drag-sorting.tsx +++ b/components/table/demo/drag-sorting.tsx @@ -1,9 +1,9 @@ import type { DragEndEvent } from '@dnd-kit/core'; -import { DndContext } from '@dnd-kit/core'; +import { DndContext, PointerSensor, useSensor, useSensors } from '@dnd-kit/core'; import { restrictToVerticalAxis } from '@dnd-kit/modifiers'; import { - arrayMove, SortableContext, + arrayMove, useSortable, verticalListSortingStrategy, } from '@dnd-kit/sortable'; @@ -77,6 +77,15 @@ const App: React.FC = () => { }, ]); + const sensors = useSensors( + useSensor(PointerSensor, { + activationConstraint: { + // https://docs.dndkit.com/api-documentation/sensors/pointer#activation-constraints + distance: 1, + }, + }), + ); + const onDragEnd = ({ active, over }: DragEndEvent) => { if (active.id !== over?.id) { setDataSource((prev) => { @@ -88,7 +97,7 @@ const App: React.FC = () => { }; return ( - + i.key)}