question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

4.0.x breaks wrapped style props

See original GitHub issue

When 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:closed
  • Created 4 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
johnryancommented, Sep 11, 2019

I reworked to use the sx and css props where appropriate ant it seems to solve the issue. Going to close this since it seems like a fine workaround. Thanks again!

0reactions
johnryancommented, Sep 11, 2019

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-ki61b

but 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} />); vs const Text = styled(Box)(themed("Text"));

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found