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

TextInput component (and maybe others) don't work with useRef #743

Open
danoc opened this issue Dec 10, 2020 · 0 comments
Open

TextInput component (and maybe others) don't work with useRef #743

danoc opened this issue Dec 10, 2020 · 0 comments

Comments

@danoc
Copy link
Member

danoc commented Dec 10, 2020

The TextInput component has two uses of ref:

  1. The public API accepts a ref prop
  2. The component has an internal ref to programmatically focus the input element

The component attempts to merge the two refs but currently doesn't work if the consumer uses useRef.

This internal/external ref pattern is common for UI libraries and there are a few solutions:

We should probably use one of these solutions rather than trying to do it ourselves. We should also audit the existing components that expose ref to see if they also don't work with useRef.

danoc added a commit that referenced this issue Dec 10, 2020
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