styled-components v5.0.0 Release Notes

Release Date: 2019-07-01 // over 4 years ago
  • ๐Ÿš€ Read the v5 release announcement!

    • 19% smaller bundle size
    • 18% faster client-side mounting
    • ๐Ÿ’… 17% faster updating of dynamic styles
    • 45% faster server-side rendering
    • ๐Ÿ‘ RTL support

    ๐Ÿ’… NOTE: At this time we recommend not using @import inside of createGlobalStyle. We're working on better behavior for this functionality but it just doesn't really work at the moment and it's better if you just embed these imports in your HTML index file, etc.

    • ๐Ÿ’… StyleSheetManager enhancements

      • you can now supply stylis plugins like stylis-plugin-rtl; <StyleSheetManager stylisPlugins={[]}>...</StyleSheetManager>
      • disableVendorPrefixes removes autoprefixing if you don't need legacy browser support; <StyleSheetManager disableVendorPrefixes>...</StyleSheetManager>
      • disableCSSOMInjection forces using the slower injection mode if other integrations in your runtime environment can't parse CSSOM-injected styles; <StyleSheetManager disableCSSOMInjection>...</StyleSheetManager>
    • โœ‚ Remove deprecated attrs "subfunction" syntax variant

      styled.div.attrs({ color: p => p.color });
    

    should become

      styled.div.attrs(p => ({ color: p.color }));
    

    You can still pass objects to attrs but individual properties shouldn't have functions that receive props anymore.

    • ๐Ÿ›  Fix attrs not taking precedence over props when overriding a given prop

    • ๐Ÿš€ (ReactNative) upgrade css-to-react-native to v3 (changelog)

      • Removed support for unitless line height in font shorthand
    • ๐Ÿ’… Replace merge-anything with mixin-deep to save some bytes (this is what handles merging of defaultProps between folded styled components); this is inlined into since the library is written in IE-incompatible syntax

    • ๐Ÿ›  Fix certain adblockers messing up styling by purposefully not emitting the substring "ad" (case-insensitive) when generating dynamic class names

    • ๐Ÿ›  Fix regressed behavior between v3 and v4 where className was not correctly aggregated between folded .attrs invocations

    • ๐Ÿ›  Fix support for styling custom elements (https://github.com/styled-components/styled-components/pull/2819)