Styled-system: Order of media queries in v5 (breakpoints object, defaultProps)

Created on 10 Jun 2019  路  3Comments  路  Source: styled-system/styled-system

Using the latest v5, I ran into an issue of media queries being ordered wrong when used with a breakpoints _object_ and defaultProps. This worked fine in v4.

Here's a https://codesandbox.io/s/styled-system-defaultprops-breakpoints-410v5 with a reproduction. I'll hold back from explaining what is going on there for now (in the hope that the sandbox code is self explanatory).

foo

image

bug

Most helpful comment

I have the same problems, in my case:

  • defaultProps now override all the props

example from rebass

const Header = styled(Text)({})

Header.defaultProps = {
  m: 0,
  mb: '8px'
}

So the defaultProps now override all m, mb when I create <Header mb={10} />

All 3 comments

I have the same problems, in my case:

  • defaultProps now override all the props

example from rebass

const Header = styled(Text)({})

Header.defaultProps = {
  m: 0,
  mb: '8px'
}

So the defaultProps now override all m, mb when I create <Header mb={10} />

I have the same issue but actually in v4. Unfortunately, for some reason, I can't reproduce it. It behaves like that in my project but not in any other environment :confused:

I think this was resolved in v5.0.18, but feel free to reopen this if you still notice the issue:
https://codesandbox.io/s/styled-system-defaultprops-breakpoints-bs2gf

Was this page helpful?
0 / 5 - 0 ratings

Related issues

genesis-algorithms picture genesis-algorithms  路  3Comments

wmarkowitz picture wmarkowitz  路  4Comments

jacek213 picture jacek213  路  4Comments

D1no picture D1no  路  4Comments

kevinSuttle picture kevinSuttle  路  4Comments