pushtell / react-bootstrap-date-picker

React-Bootstrap based date picker.
MIT License
346 stars 195 forks source link

Can't select date #82

Closed drc37 closed 7 years ago

drc37 commented 7 years ago

I am getting this weird error where I can't select the date from the popover. If I manually change the date, the onChange event occurs. But, when I try to select a date, nothing happens. I have put a few console.logs in there. The onChange isn't being called. There are multiple datepickers but each has a unique ID.

The render method for that component is being called each time I click on a date. I don't know what is causing this though. What am I doing wrong?

This is how I have it setup: import DatePicker from "react-bootstrap-date-picker";

<DatePicker
                    id={"due-date-datepicker-" + id}  << (ID is the object ID of the item being selected)
                    disabled={false}
                    placeholder="Select due date..."
                    dateFormat="MM/DD/YYYY"
                    value={this.state.dueDate}
                    onChange={() => { console.log("DatePicker onChange")}} << (I had this set like the example, but it wasn't being called.)
                    onFocus={() => { console.log("DatePicker Focus")}}
                    onBlur={() => { console.log("DatePicker Blur")}}
                  />
drc37 commented 7 years ago

Another component was causing the re-render. Sorry.