pushtell / react-bootstrap-date-picker

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

minDate causes duplicate react key warnings #146

Open ost-ing opened 6 years ago

ost-ing commented 6 years ago

When configuring the date-picker to use the minDate prop, multiple react warnings are produced. This is what I am rendering:

<FormGroup validationState={this.state.validation.date}>
    <ControlLabel>Start Date</ControlLabel>
    <DatePicker
        id="formControlsStartDate"
        value={this.state.date}
        onChange={date => this.setState({ date })}
        minDate={(new Date()).toISOString()}
        showClearButton={false}
    />
    <FormControl.Feedback />
</FormGroup>

The warning produced:

Warning: flattenChildren(...): Encountered two children with the same key, 5. Child keys must be unique; when two children share a key, only the first child will be used. in tr (created by DatePickerCalendar) in tbody (created by DatePickerCalendar) in table (created by DatePickerCalendar) in DatePickerCalendar (created by DatePicker) in div (created by Popover) in div (created by Popover) in Popover (created by DatePicker) in Position (created by Overlay) in Transition (created by Fade) in Fade (created by Overlay) in RootCloseWrapper (created by Overlay)

Proj. Dependencies:

"react": "^15.6.1", "react-bootstrap": "^0.31.2", "react-bootstrap-date-picker": "^5.1.0",

Kind regards.

powellandy commented 6 years ago

I also see this:

"react": "^15.6.2", "react-bootstrap": "^0.31.3", "react-bootstrap-date-picker": "^5.1.0",

codrobin33 commented 6 years ago

I am also seeing this

"react": "^15.3.2", "react-bootstrap": "^0.31.2", "react-bootstrap-date-picker": "^5.1.0",

MattJonesCreation commented 6 years ago

I am also seeing this, was this ever resolved or even looked at? Is this repo deprecated?

adam-bubela commented 6 years ago

It the same warning is caused by the param maxDate. Anybody managed to fix it?

MattJonesCreation commented 6 years ago

@adam-bubela I was able to fix this by using @JonShort 's fork.

https://www.npmjs.com/package/jonshort-shim-react-bootstrap-date-picker