styled-components v5.0.0 Release Notes

Release Date: 2019-07-01 // 9 months 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