react-date-range
react-date-range copied to clipboard
DateRange.updatePreview : ReferenceError: Cannot access 'color' before initialization
DateRange.updatePreview : ReferenceError: Cannot access 'color' before initialization
init the color before initialisation
const color = ranges[focusedRange[0]]?.color || rangeColors[focusedRange[0]] || color;
[BUG] Bug Reproduce Steps
Just render the DateRange component and do hover some date.
[BUG] Expected behaviour
Show the hover
Environment
Package Version: 2.0.1 React version: 17 Node version: 18 Browser: chrome
When using the Google Close Compiler with the library, I get a similar error:
Closure compilation failed with 1 errors
--- node_modules/react-date-range/dist/components/DateRange/index.js:145
Illegal variable reference before declaration: color
Related or duplicated: https://github.com/hypeserver/react-date-range/issues/642 https://github.com/hypeserver/react-date-range/issues/474