我已经尝试将react-beautiful-dnd与React Semantic UI Table结合使用,但由于提供了innerRef问题(https://github.com/atlassian/react-beautiful-dnd/blob/master/docs/guides/using-inner-ref.md),因此我无法使其正常工作。我已经看到一些用户也遇到了材料ui的类似问题。 (Use material-ui table with react-beautiful-dnd)。以下是适用于普通html表但不适用于语义ui react表的代码示例:https://codesandbox.io/s/l467j0wj7m。我将不胜感激任何反馈,解决方案或解决方法。
我有同样的问题,找到了解决方案here。
在Ref
周围放置Table.Body
,然后将provided.innerRef
设置在Ref
而不是Table.Body
上:
{(provided, snapshot) => (
<Ref innerRef={provided.innerRef}>
<Table.Body {...provided.droppableProps}>
</Table.Body>
</Ref>
)}
与Table.Row
相同:
{(provided, snapshot) => (
<Ref innerRef={provided.innerRef}>
<Table.Row {...provided.draggableProps}
{...provided.dragHandleProps}>
</Table.Row>
</Ref>
)}
这应该可以解决问题。希望能对某人有所帮助。