我正在尝试实现ReactCSSTransitionGroup,它以Appear开头,但从不移至Enter或Exit

时间:2018-11-11 02:26:21

标签: reactjs reactcsstransitiongroup

“出现”工作正常,但从不进入“进入”状态。 我找不到它们适用于“出现”状态,完成后停止。

import ReactCSSTransitionGroup from 'react-addons-css-transition-group';

JavaScript代码:

<ReactCSSTransitionGroup transitionName="example" 
  transitionAppear={true}
  transitionAppearTimeout={2000}
  transitionEnter={true}
  transitionEnterTimeout={2000}
  transitionLeave={true}
  transitionLeaveTimeout={300}
>
  <h1>Welcome {this.state.username}!</h1>
</ReactCSSTransitionGroup>

CSS代码:

.example-appear {
  opacity: 0.01;
  color: blue;
}

.example-appear.example-appear-active {
  opacity: 1;
  transition: opacity 2s;
  color: orange;
}

.example-enter {
  opacity: 0.01;
  color: green;
}

.example-enter.example-enter-active {
  opacity: 1;
  transition: opacity 1000ms ease-in;
  color: red;
}

0 个答案:

没有答案