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

Expose ref for <input type="file"> element #163

Open
justrhysism opened this issue Jan 6, 2021 · 5 comments
Open

Expose ref for <input type="file"> element #163

justrhysism opened this issue Jan 6, 2021 · 5 comments

Comments

@justrhysism
Copy link

Is your feature request related to a problem? Please describe.
Currently, it's not possible to get the ref for the underlying <input> element which makes this library difficult to use with libraries like "react-hook-form".

Describe the solution you'd like
Expose a prop inputRef so the author can provide their own ref.

Describe alternatives you've considered
Hacky solutions of traversing the DOM 😢

Additional context
N/A

@justrhysism justrhysism changed the title Expose ref for <input> element Expose ref for <input type="file"> element Jan 6, 2021
@rikschennink
Copy link
Collaborator

FilePond generates a custom list of input elements to store its data, the elements are removed when files are deleted, not sure how that would work with a ref

@bishnu-47
Copy link

how to get the file inside onSubmit then?

@rikschennink
Copy link
Collaborator

get a ref to FilePond component and call getFiles() on the FilePond instance in the ref.

@CestDiego
Copy link

I'm having an issue with this too because, even though we can submit by just querying the data. Now we don't get the awesome type checking that comes from using react-hook-form with a validator.

Regardless, thanks for working on this :D.

@rikschennink
Copy link
Collaborator

@CestDiego good point, I believe with the way I set up FilePond v5 this is addressed, so should be better in the future.

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

4 participants