[Feature] Styling components with props other than style
See original GitHub issueThank you for this amazing lib!!
Could we style components with props other than style? If not, I am making a feature request.
I am trying to style a Swipeable component. Naturally I wanna keep using NativeWind with all the theme setup. Basically, I would like to use something similar to sx hook in Dripsy but with tailwind class name. eg.
<FlatList
contentContainerStyle={sx("flex-1 h-full")}
data={data}
renderItem={renderItem}
/>
Issue Analytics
- State:
- Created a year ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
8 awesome features of styled-components - LogRocket Blog
8 awesome features of styled-components · 1. Style inheritance · 2. Passing props · 3. Theming · 4. Global styling · 5. Switching...
Read more >Advanced Usage - styled-components
styled-components generates an actual stylesheet with classes, and attaches those classes to the DOM nodes of styled components via the className prop. It ......
Read more >Support for class props other than className · Issue #3179 ...
Currently styled-components only supports styling via the className prop requiring hacky workarounds to make use of the other props. Take for ...
Read more >How To Use Styled-Components In React - Smashing Magazine
Adapting Based on Props # Styled components are functional, so we can easily style elements dynamically. Let's assume we have two types of ......
Read more >Style React Components: 7 Ways Compared - SitePoint
Props can be used to style styled components in the same way that they ... I had a bit of a struggle with...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Styled will not style nested props. You can fix your issues by simply evaluating the prop you wish to style
Hi @marklawlor , I did not want to reopen an issue because my problem looks pretty similar, but do you have an example when you have to pass a style object (and you cannot derive a styled component to embed tailwind class names ?)
For example, coming from tailwind-react-native-classnames, I have a
BottomTabNavigator
from@react-navigation/bottom-tabs
and I’m styling theTabBarLabel
like this :Do you have an idea of how I can achieve it with nativewind ?
Thanks, and awesome work by the way 😃