简体   繁体   中英

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

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. So, I have two components: In one component is the code of redux-form and where importing the custom component DatePicker. In the component DatePicker is where I placed all regarding react-dates with its component The trick worked.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM