4.0.x breaks wrapped style props
See original GitHub issueWhen wrapping a component in 4.0 it appears that the props are no longer passed to the rebass components.
Here’s an example with 3.x: https://codesandbox.io/s/affectionate-golick-0lio2
You can see that the color
prop gets passed down to the rebass text and gets colored red
However in 4.x: https://codesandbox.io/s/lucid-cartwright-vdrbx
The extended component loses the color
prop (with both emotion and styled-components)
Issue Analytics
- State:
- Created 4 years ago
- Comments:10 (4 by maintainers)
Top Results From Across the Web
Separate HTML attributes from styling props #439 - GitHub
I am trying to style a 3rd party "masked" input. The styles are applied correctly, however, there are props I pass into the...
Read more >How To Style React Components | DigitalOcean
In this tutorial, you'll learn three different ways to style React components: plain Cascading Style Sheets (CSS), inline styles with ...
Read more >React native text going off my screen, refusing to wrap. What ...
So now you have a wrapper view that should vertically and horizontally align it's content and stack it along the x-axis. I then...
Read more >Style Props - Chakra UI
Style props are a way to alter the style of a component by simply passing props to it. It helps to save time...
Read more >Releases - styled-components
Transient props are a new pattern to pass props that are explicitly consumed only by styled components and are not meant to be...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I reworked to use the
sx
andcss
props where appropriate ant it seems to solve the issue. Going to close this since it seems like a fine workaround. Thanks again!I think you’re right about the
as
issue (it works fine if i don’t use that). I set up a trimmed down example here: https://codesandbox.io/s/optimistic-mcnulty-ki61bbut it looks like it basically comes down to how the
Text
component is built…namely:
const Text = forwardRef((props, ref) => <Box ref={ref} tx="text" {...props} />);
vsconst Text = styled(Box)(themed("Text"));