React - ReactCSSTransitionGroup更改transitionName

时间:2017-06-25 02:42:41

标签: reactjs

我从这里使用ReactCSSTransitionGroup:https://facebook.github.io/react/docs/animation.html 有没有办法改变transitionName="example"让它取一个对象而不是字符串? transitionName={styles.example}

1 个答案:

答案 0 :(得分:1)

以下是文档中的示例:https://facebook.github.io/react/docs/animation.html#custom-classes

// ...
<ReactCSSTransitionGroup
  transitionName={ {
    enter: 'enter',
    enterActive: 'enterActive',
    leave: 'leave',
    leaveActive: 'leaveActive',
    appear: 'appear',
    appearActive: 'appearActive'
  } }>
  {item}
</ReactCSSTransitionGroup>

<ReactCSSTransitionGroup
  transitionName={ {
    enter: 'enter',
    leave: 'leave',
    appear: 'appear'
  } }>
  {item2}
</ReactCSSTransitionGroup>
// ...