-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Brush component does not work with Styled Components #4217
Comments
I found this thread here about other library, seems quite similar |
recharts was not built with styled components in mind and styled components isn't really a recommended way of styling recharts charts. Even if it did render, styles may not be exactly what you want/are expecting. Set But as you can see the fill/stroke specification only affects the text of the Brush here, wheras directly specifying |
hey @ckifer ! thanks so much for taking your time to answer this ❤️ I've been reading about this
take this snippet into consideration, if you will
styled components is throwing the error in the screenshot I guess this is some TS matter... |
I'm not sure its the responsibility of recharts to support how TypeScript behaves with a specific library (i.e. styled-components). That being said, this could be because Brush is a class component? https://github.com/recharts/recharts/blob/3.x/src/cartesian/Brush.tsx#L120 Does this work with any other recharts components? Or do all of them throw TS errors? Try with a function component like Label https://github.com/recharts/recharts/blob/3.x/src/component/Label.tsx |
hey @ckifer thanks for your support ❤️
I thought same, let me check and ping you back |
There is currently no fix for this, but we are trying to refactor things. Eventually that will to be 100% function components. This isn't feasible at the moment due to time, due to inability to identify potential regressions (lack of test coverage), and due to other priorities, but it will be solved eventually (though eventually isn't defined very well, could be years) |
Going to close this, our eventual refactorings will solve this issue albiet indirectly |
Reproduction link
Steps to reproduce
What is expected?
Brush component renders in both cases
What is actually happening?
Brush does not render
On my local project, I can see a TS error:
but it renders.
The text was updated successfully, but these errors were encountered: