'Airbnb react-dates DayRangePickerController: onFocusChange func doesn't work
I've used Airbnb react-dates library, https://github.com/react-dates/react-dates
react-dates version "react-dates": "^21.8.0",
I wrote the same code with component, but in component, onFocusChange func props doesn't work.
this code works: onFocusChange={console.log('test')} it prints 'test'
but this code doesn't: onFocusChange={focusedInput => console.log(focusedInput)}
Since other components like DateRangePicker works well, it prints focusedInput with the code above, I have no idea what the problem is..
Source code (including props configuration)
return (
<DayPickerRangeController
startDate={startDate}
endDate={endDate}
onDatesChange={handleDatesChange}
focusedInput={focusedInput}
onFocusChange={focusedInput => setFocusedInput(focusedInput)} // here
numberOfMonths={2}
initialVisibleMonth={() => initialMonth}
noBorder={true}
small={true}
// customArrowIcon={null}
/>
);
and this is my github link
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
