Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flatpickr instance is available at flatpickr rather than _flatpickr as main docs say #222

Open
jakeparis opened this issue May 9, 2024 · 0 comments

Comments

@jakeparis
Copy link

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} />
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant