Reactjs 如何将react运动库与modals一起使用
我使用react模态创建模态,并尝试从页面底部滑动模态。为此,我尝试使用react-motion-transition-motion组件。我的代码是:Reactjs 如何将react运动库与modals一起使用,reactjs,react-native,react-redux,react-router,react-motion,Reactjs,React Native,React Redux,React Router,React Motion,我使用react模态创建模态,并尝试从页面底部滑动模态。为此,我尝试使用react-motion-transition-motion组件。我的代码是: { this.state.openNumberPopup && <TransitionMotion styles={[{key: 'key',style: this.getStyles()}] } > { (interpolated) => <div>
{ this.state.openNumberPopup &&
<TransitionMotion
styles={[{key: 'key',style: this.getStyles()}] }
>
{
(interpolated) =>
<div> {
interpolated.map(({ key, style, data }) =>
<NumberPopup
key={${key}-transition}
style={{opacity: style.opacity,transform: scale(${style.scale})}}
openNumberPopup={this.state.openNumberPopup}
toggleNumberPopup={this.toggleNumberPopup}
handleChange={this.handleChange}
updateNumber={this.updateNumber}
disableSubmit={this.state.disableSubmit}
/>
)
}
</div>
}
</TransitionMotion>
}
但这不起作用,因为模态组件。我以错误的方式使用了TransitionMotion。相反,我在这里使用了运动,我用的是错误的过渡运动。相反,我在这里使用了运动。
getStyles = () => ({ opacity: spring(1), scale: spring(1) });