Drag and drop works per designed.
Throws Invariant failed: Expected phase to be DRAGGING after INITIAL_PUBLISH when dragging starts.
react-beautiful-dnd works with react-window.FixedSizeList, and a function that operates on it (e.g. (position) => listRef.current.scrollToItem(position, "start").Row and Item and finally use the function passed down in an onClick event.Nil.
React are you using?16.13.1
react-beautiful-dnd are you running?13.0.0
Chrome 84.0.4147.105 on macOS Catalina 10.15.6 (19G73)
https://codesandbox.io/s/admiring-kapitsa-4678m?file=/src/App.tsx:1552-1571
@blueset Seems like a duplicate of https://github.com/atlassian/react-beautiful-dnd/issues/1647
I got the exact error when passing extra arguments. The solution is to pass those arguments into itemData.
<FixedSizeList
ref={listRef}
height={height}
width={width}
itemSize={60}
itemData={{ tracks, jumpTo }}
itemCount={tracks.length}
outerRef={droppableProvided.innerRef}
>
{Row}
</FixedSizeList>
and pull it form data
function Row(
props: ListChildComponentProps & { jumpTo: (index: number) => void }
) {
const { data, index, style } = props;
const item: Track = data.tracks[index];
const jumpTo = data.jumpTo
return (
<Draggable
draggableId={`nowPlaying-draggable-${item.id}`}
index={index}
key={item.id}
>
{(provided) => (
<CurrentPlaylistItem
index={index}
track={item}
isDragging={false}
style={style}
jumpTo={jumpTo}
provided={provided}
/>
)}
</Draggable>
);
}
Most helpful comment
@blueset Seems like a duplicate of https://github.com/atlassian/react-beautiful-dnd/issues/1647
I got the exact error when passing extra arguments. The solution is to pass those arguments into
itemData.and pull it form
data