我正在尝试使用React Semantic UI的Transition为基于React类的组件的进入和退出设置动画。但它不起作用。见https://codesandbox.io/s/k23z06o43r?fontsize=14。
在片段中,我有3个实验:
你的PackageComponent
应该传播未处理的道具和合并样式:
class PackageComponent extends React.Component {
render() {
return (
/* Spread below is important */
<Container {...this.props} style={{ ...styleObj, ...this.props.style }}>
{this.props.children}
</Container>
)
}
}
更新了CodeSandbox:https://codesandbox.io/s/8zk6v6wzw8
好吧,我自己从来没有使用过这个库,但是看起来语义ui与转换组件内部的客户组件无法正常工作。您可以使用semantic-ui中的Container组件,然后只需将您的客户组件作为子项传递即可。