react-date-range icon indicating copy to clipboard operation
react-date-range copied to clipboard

onRangeFocusChange used with DateRangePicker breaks usage of state.focusedRange

Open bertho-zero opened this issue 5 years ago • 3 comments

https://github.com/hypeserver/react-date-range/blob/33f2294eabc13f2413895faf9125e0cf0385dcad/src/components/DateRangePicker/index.js#L18

https://github.com/hypeserver/react-date-range/blob/33f2294eabc13f2413895faf9125e0cf0385dcad/src/components/DateRangePicker/index.js#L33

As soon as we define the onRangeFocusChange prop, it overwrites the internal function and the state is no longer updated

bertho-zero avatar Oct 28 '20 16:10 bertho-zero

I'm having this issue as well

robbienohra avatar Nov 03 '20 18:11 robbienohra

me too

danielrussellLA avatar May 09 '23 21:05 danielrussellLA

a workaround for now:

const [focusedRange, setFocusedRange] = useState([0,0])

const onRangeFocusChange = (item) => {
  setFocusedRange(item)
}

<DatePicker
  focusedRange={focusedRange}
  onRangeFocusChange={onRangeFocusChange}
/>
    

danielrussellLA avatar May 09 '23 21:05 danielrussellLA