You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support for style-related props (not set via 'style') in React Native #149
Presently in styled components, there is no way to affect other style-related props in React Native.
This style-related-prop-not-defined-via-style can be found in many third party libraries (such as React Native Navbar's tintColor prop), in custom components one might write themselves, and in React Native's core components, for example:
It's of course possible to simply set these props manually, but styled-component's themes are unable to be leveraged to standardize them across the codebase.
Reacted by Edygar de Lima Oliveira, Irakli Janiashvili, Christian Meunier, Bruno Lemos, Anton Versal, Patrick Bassut and Ross Khanas
That's an unnecessary escape hatch @adamterlson, since you can already set any prop desired when rendering. I think with the list @irakli-janiashvili dug up we should be fine to publish a first version with support for these. It doesn't matter if it's not 100% complete, as we can always add more to the list.
Basically, what we should do is have a separate module called react-native-style-props which exports an object. This object should be keyed by primitive and each one should have an array of props like this maybe?
Then from styled-components we can check at creation time if the current property is supported as a prop, and pass it to the underlying primitive. What do you think, does somebody want to go ahead and create that repo?
Reacted by Irakli Janiashvili, Anton Versal, Patrick Bassut, Rustem Mussabekov, Kristian Gerardsson, Vincent M. van der Meulen, Gary Hsu, Ajay Saini, Loginov Roman, Mahendra Liya and 1 more
Reacted by David Novák, Ajay Saini, Kened Oliveira, Loginov Roman and Fellyp Karlon
Activity
IrakliJani commentedon Nov 9, 2016
This definitely will be a great enhancement!
mxstbr commentedon Nov 9, 2016
Is there a list of the ones that exist somewhere? We should definitely add support for them!
adamterlson commentedon Nov 9, 2016
@mxstbr I'm unaware of any existing list. The only option would be to go through every available component and manually catalog them, as far as I know
IrakliJani commentedon Nov 9, 2016
I can volunteer to go through and get the list of those items.
mxstbr commentedon Nov 10, 2016
That would be amazing @irakli-janiashvili! 🙏
IrakliJani commentedon Nov 10, 2016
@mxstbr @adamterlson
Here's the list of all possible attributes that can go in styles -> https://gist.github.com/irakli-janiashvili/dac99f8ceb0c1a9bafa78aad0f19d861
I put a question marks in front of some attrs that I'm not sure we have to put in styles..
adamterlson commentedon Nov 12, 2016
It seems like a lot to maintain manually.
Why not simply provide a way to generally set any prop desired?
mxstbr commentedon Nov 20, 2016
That's an unnecessary escape hatch @adamterlson, since you can already set any prop desired when rendering. I think with the list @irakli-janiashvili dug up we should be fine to publish a first version with support for these. It doesn't matter if it's not 100% complete, as we can always add more to the list.
Basically, what we should do is have a separate module called
react-native-style-propswhich exports an object. This object should be keyed by primitive and each one should have an array of props like this maybe?Then from
styled-componentswe can check at creation time if the current property is supported as aprop, and pass it to the underlying primitive. What do you think, does somebody want to go ahead and create that repo?mxstbr commentedon Jul 1, 2017
This is now finally possible in version two with the
.attrsconstructor!