React beautiful dnd无法与React Semantic UI Table一起使用

问题描述 投票:0回答:1

我已经尝试将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。我将不胜感激任何反馈,解决方案或解决方法。

reactjs semantic-ui-react
1个回答
0
投票

我有同样的问题,找到了解决方案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>
)}

这应该可以解决问题。希望能对某人有所帮助。

© www.soinside.com 2019 - 2024. All rights reserved.