glamorous-native
glamorous-native copied to clipboard
Creating styles that can be passed as style prop
Hey,
I'm using an external library that only allows styling over different props (like containerStyle
, textStyle
, ...). Now I would like to know, if I can still use glamorous-native to create those styles because I'd like to use theme props.
Thank you very much.
Hi @baba43,
did you ever find the answer you were looking for?
Glamorous does not have built in support to target a different property other than style
, but you can always map that prop to something else, for example:
const YourContainerStyledComponent = glamorous(({style, ...props}) => (
<YourComponent {...props} containerStyle={style} />
))(yourStyles)
And if you do this frequently, or need to compose different props at the same time, this could be abstracted away into some HoCs