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
Working ref props for all components #2665
Comments
Is there any update on this being implemented? We're trying to build some custom positioning logic for the tooltip and were looking to use a ref prop on the |
+1 here. Trying to use this on ResponsiveContainer and get a deprecation warning. |
@roger-tbg there should only be a warning if you use ref.current.current on responsive container. That was a mistake and has been corrected backwards compatibility. The warning is just saying we'll change to the correct ref.current implementation in the next breaking release (3.0) |
@ckifer This is the relevant code:
|
https://github.com/recharts/recharts/blob/master/src/component/ResponsiveContainer.tsx#L75 This was done with the intent to fix the Your usage is fine and isn't being deprecated, the log message just fires in both cases. Thanks for the heads up on that. |
<!--- Provide a general summary of your changes in the Title above --> ## Description #2665 (comment) <!--- Describe your changes in detail --> ## Related Issue <!--- This project only accepts pull requests related to open issues --> <!--- If suggesting a new feature or change, please discuss it in an issue first --> <!--- If fixing a bug, there should be an issue describing it with steps to reproduce --> <!--- Please link to the issue here: --> ## Motivation and Context <!--- Why is this change required? What problem does it solve? --> ## How Has This Been Tested? <!--- Please describe in detail how you tested your changes. --> <!--- Include details of your testing environment, and the tests you ran to --> <!--- see how your change affects other areas of the code, etc. --> ## Screenshots (if appropriate): ## Types of changes <!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: --> - [x] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) ## Checklist: <!--- Go over all the following points, and put an `x` in all the boxes that apply. --> <!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> - [x] My code follows the code style of this project. - [ ] My change requires a change to the documentation. - [ ] I have updated the documentation accordingly. - [x] I have added tests to cover my changes. - [ ] I have added a storybook story or extended an existing story to show my changes - [x] All new and existing tests passed.
@roger-tbg warn issue should be fixed in 2.12.2 |
Hi. Is there any update on this being implemented?
React: 17.0.2 I try update versions but no working. |
No updates - it needs worked on if anyone wants to help out |
What problem does this feature solve?
Gaining access to the component's element via ref and acting on it in some way as you would in the usual
useRef()
way. For example, if a dev wanted to get the dimensions of the<YAxis>
component, the use of a working ref prop would make this very simple to do.What does the proposed API look like?
The
ref
prop already exists on components used within charts, but they do not seem to work for all components. Possibly this is an issue with the components not properly forwarding their refs? Or possibly just an oversight with leaving the ref prop exposed?Code example:
Currently, this gives us
null
foryAxisRef.current
when we access it insideuseEffect
, whereas we would expect either the element or class forYAxis
.The text was updated successfully, but these errors were encountered: