styled-components / styled-components

Visual primitives for the component age. Use the best bits of ES6 and CSS to style your apps without stress 💅
https://styled-components.com
MIT License
40.11k stars 2.48k forks source link

Export the `toStyleSheet` function #4284

Closed TikiTDO closed 1 month ago

TikiTDO commented 1 month ago

This function could be useful in a ReactNative app when doing something like this:

<ScrollView contentContainerStyle={[reactNativeStyles.flexSingle]}>
   ...

At the moment we have to keep a part of our styles config using StyleSheet.create because there's a few places that are not handled by the styled-component magic interpolation.

If this function was available to import, then it would allow us to use the same styling rules everywhere.

If this is acceptable then I can submit a PR.

krudos commented 1 month ago

you can use like this

import {toStyleSheet} from 'styled-components/native';
TikiTDO commented 1 month ago

@krudos Are you sure about that?

image

I tried checking if it's just the types, but even ignoring the type errors I don't see that sort of import:

image

TikiTDO commented 1 month ago

Ah, I'm out of date. That would do it.