ResistanceCalendar / resistance-calendar-frontend

A central listing of upcoming progressive events
https://resistance-calendar-staging.herokuapp.com/
MIT License
7 stars 8 forks source link

Make a second click to the calendar icon close the calendar pop up #105

Open InciteDemocracy opened 7 years ago

InciteDemocracy commented 7 years ago

A second click to the button that opened the popup should close it.

pfarnach commented 7 years ago

I played around with this for a bit and had to timebox it. This is a bit tricky due to the datepicker not exposing the open state and setOpen method. These can be reached by using the ref attribute but I had already spent too much time on this for now.

for reference: https://github.com/Hacker0x01/react-datepicker/issues/283#issuecomment-223517743

wwwebman commented 6 years ago

Hmmm, startOpen prop is exist, but isOpen missed. I think, isOpen should be added to prevent ref manipulation, it's so tricky doing it with ref. Especially, if you want to use functional component with more then one datapicker :)