renderMask() {
const { openType } = this.state
const isHide = openType === ‘more‘ || openType === ‘‘
return (
<Spring from={{ opacity: 0 }} to={{ opacity: isHide ? 0 : 1 }}>
{props => {
// 说明遮罩层已经完成动画效果,隐藏了
if (props.opacity === 0) {
return null
}
return (
<div
style={props}
className={styles.mask}
onClick={() => this.onCancel(openType)}
/>
)
}}
</Spring>
)
原文:https://www.cnblogs.com/xm0328/p/14225468.html