-
-
Notifications
You must be signed in to change notification settings - Fork 756
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
Use forwardRef
with IconBase
#336
Comments
Really need this. Please consider it |
Bumping this issue. Would be nice to have this. |
been 3 years and still no fix, crazy |
@KeUnstackDetachProcess if someone was to reimplement #367 (it's 3 years old at this point) and address the concerns in the PR comments, I'm sure @kamijin-fanta would be open to accepting the change. Just need someone to champion the change. |
would be really nice to have this |
Just found out I have use case for using the |
I've created a PR that should do the trick. |
I may provide an API to add wrapper elements in the future. #719 Are the props to be added "innerRef" which always exposes a reference to the SVG element or "ref" which exposes a reference to the top level element? |
In my PR, it forwards the ref using React.forwardRef, so it exposes the "ref" prop correctly. |
Had a chance to look at fauri's PR. The ref is set up to the |
Can't believe this wasn't in here from the start. However I think this will no longer be a problem with React 19, because the ref should automatically be forwarded (assuming all other props are passed e.g. |
@kamijin-fanta What are we waiting to fix this? #367 Is stuck in the build step Would you tell us what is the current status for this issue, please? |
Is your feature request related to a problem? Please describe.
Chakra UI provides a
Tooltip
component that displays a tooltip when the component'schildren
are hovered. In order to make this functionality work, we depend on the outermost child ofTooltip
accepting aref
. SinceIconBase
does not forward refs, we are unable to makeTooltip
work correctly if the outermost child is areact-icons
icon.See chakra-ui/chakra-ui#683 for a related issue on our end.
Describe the solution you'd like
Integrate
React.forwardRef
intoIconBase
so that icons generated byreact-icons
can accept aref
, increasing their flexibility and reusability.See https://reactjs.org/docs/forwarding-refs.html#forwarding-refs-to-dom-components for more details.
Describe alternatives you've considered
The only solution we have for our users is that they should wrap their
react-icons
icons with a component that forwards refs if they would like to wrap the icon withTooltip
.Additional context
This would be a breaking change. https://reactjs.org/docs/forwarding-refs.html#note-for-component-library-maintainers
The text was updated successfully, but these errors were encountered: