onefinestay / react-daterange-picker

Other
563 stars 209 forks source link

setting state inside `onSelectStart` disables date range selection #203

Open nachikethashu opened 5 years ago

nachikethashu commented 5 years ago

Here's the link to the issue reproduced in codesandbox - https://codesandbox.io/s/vjq31pov87

Click on any date and it'll never go into range selection mode. keeps getting stuck in from-date selection.

All I'm doing there is setting some state inside(not related to range) onSelectStart handler.

Is it a bug from the component or my logic?

nachikethashu commented 5 years ago

Hello, Can you confirm whether it's a bug or not?

AlanFoster commented 5 years ago

Hi @nachikethashu - Could you clarify what you would like to happen?

Do you want multiple selected ranges?

nachikethashu commented 5 years ago

No, If you check this - https://codesandbox.io/s/vjq31pov87 you can see that the range selection is not working here.

It works only if you remove setState inside handleDateRangeSelectStart