Skip to content

Commit

Permalink
fix(Transition): 动画完成即触发 onTransitionEnd 事件
Browse files Browse the repository at this point in the history
  • Loading branch information
fjc0k committed Mar 20, 2019
1 parent 10d0e38 commit 4a806d9
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/components/Transition/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,10 @@ export default class MTransition extends component({
}

handleAnimationEnd = () => {
this.setState(
{ display: this.props.visible },
() => {
this.props.onTransitionEnd()
},
)
this.setState({
display: this.props.visible,
})
this.props.onTransitionEnd()
}

render() {
Expand All @@ -93,8 +91,8 @@ export default class MTransition extends component({
className={`m-transition m-transition__${name} ${className}`}
style={{
WebkitAnimationName: animationName,
animationName: animationName,
WebkitAnimationDuration: animationDuration,
animationName: animationName,
animationDuration: animationDuration,
...(display ? {} : { display: 'none' }),
}}
Expand Down

0 comments on commit 4a806d9

Please sign in to comment.