react-flatpickr
react-flatpickr copied to clipboard
Flatpickr instance is available at `flatpickr` rather than `_flatpickr` as main docs say
The main docs for Flatpickr say that the instance can be accessed on the dom element at the _flatpickr
property
https://flatpickr.js.org/instance-methods-properties-elements/#retrieving-the-flatpickr-instance
However, when trying to access the instance when using this React library, it seems only available at flatpickr
(without the leading underscore). This should probably be fixed for consistency.
Example:
const fp = useRef(null)
useEffect(()=>{
// According to the Flatpickr docs, I'd expect the flatpickr instance available like this:
fp.current._flatpickr.set( 'allowInput', true );
// but instead, it needs to be accessed like this:
fp.current.flatpickr.set( 'allowinput', true );
}, [ somethingElse ] );
return (
<Flatpickr ref={fp} />
);