LoicMahieu/react-styled-flexboxgrid

Using SC's attrs passes down non-DOM props

aaronmcadam opened this issue · 7 comments

Hi there, thanks for a great library!

With styled-components v2, there's a new attrs API that simplifies wrapping third-party components.

However, wrapping one of react-styled-flexboxgrid's components, for example Col, raises:

Warning: Unknown prop `theme` on <div> tag. Remove this prop from the element

Here's the gist: https://gist.github.com/aaronmcadam/52b5d1f93d472ce5f33738c8f52b76ed

If we replace this sort of logic with styled.div, it might work.

If we need to use another tag name, we can call .extendWith('section')() on it

Hi

Thanks to point me the .attrs() method. It looks powerful.
But at this time the v2 is not yet stable. We could maintain a side branch, like next. Are you interested to make a PR for support v2 ?

v2 has been officially released. Did you have any ideas on how we might fix this issue @LoicMahieu?

Houra! 🎉

I suppose that if we just remove the support for tagName prop, we could simply use a styled.div and... done ?

That would be the fastest fix and then we could look at supporting custom tags later, maybe using the withComponent method.

Thanks for sorting this! ❤️