-
Notifications
You must be signed in to change notification settings - Fork 36
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 refs for all components #126
Comments
I think a nice way to do this would be to use the new ref forwarding api, use the same ref name for all components, and add tests to ensure we don't break that contract/api. It would require latest React, but maybe we could add in a fallback if the forwarding method isn't supported? |
@dcocchia sounds perfect. That's why I haven't started it, actually. Been hesitant to add in logic that may become moot once forwarded refs are in place. |
Any of the components using Radium will need to take this issue into consideration. Ideally the Radium and withTheme higher order components would forward refs. This would maximize our code reusability and reduce complexity.
However, due to this issue we need to use React.forwardRef on the final export instead and pass the ref down the tree via a different property name (such as forwardRef). At the leaf level we can then assign the component's ref property to the value from props.forwardRef.
|
I am putting my work on hold while the Radium team is investigating. If Radium ends up not supporting forward refs, we should discuss using the innerRef strategy that many other component libraries use. |
Forwardref is not going to be compatible with Radium. Let's move forward with the innerRef strategy. |
Many of our components do not set a
ref
on their main output, so users of the library will be forced to use findDOMNode to do things like focus on a button or input.We should add a
ref
to each component to help with this.The text was updated successfully, but these errors were encountered: