[英]Airbnb/react-dates with a redux-form
I can fire the calendar of AirBnb react-dates within the render function of React,but if I try out in a function referenced within of redux-form, there is no error and it display the initial dates correctly but when clicking don't fire the calendar 我可以在React的render函数中触发AirBnb react-date的日历,但是如果我尝试在redux-form内引用的函数中尝试,则不会出现错误,并且可以正确显示初始日期,但是单击时不触发日历
BELOW WORKS
class Landing extends React.Component {
state
....
render(){
return (<form>
<DateRangePicker (+props) />
</form>)
}
}
BELOW DISPLAY THE INITIAL FIELDS WITH THE DATES AND THERE ARE NO
ERRORS, BUT WHEN CLICKING DON'T FIRE THE CALENDAR
Class Landing extends React.Component {
state
....
renderCalendar=()=>{
return (<DateRangePicker (+props)/>)
}
render(){
return (
<form>
<Field component={this.renderCalendar}/>// Field from
react-redux
</form>
)
}
}
I sorted taking away all the code of react-dates to another component. 我整理了一下,将所有react-dates的代码移交给另一个组件。 So, I have two components: In one component is the code of redux-form and where importing the custom component DatePicker.
因此,我有两个组件:在一个组件中是redux-form的代码,在其中导入自定义组件DatePicker。 In the component DatePicker is where I placed all regarding react-dates with its component The trick worked.
在组件DatePicker中,我将所有有关react-dates与其组件放置在一起。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.