onefinestay / react-daterange-picker

Other
563 stars 209 forks source link

setState in onSelectStart function is not working #224

Open mpotnu opened 4 years ago

itsmeganesh-cse-iiit commented 4 years ago

Same issue here also, I am unable execute anything inside the onSelectStart method, If I try to execute anything apart from console log or alert then date range selection not working

detrash08 commented 4 years ago

Hi, same issue. I'm trying to update a "start date" field content calling onSelectStart. It seems that when you change the DateRangePicker value field, passing an updated range, the component clears the current selection. I've found this in DateRangePicker.componentWillReceiveProps:

const updatedState = {
    selectedStartDate: null,
    ...
}

The "selectedStartDate" state field seems to be used to determine how and what has to be highlighted.