-
-
Notifications
You must be signed in to change notification settings - Fork 170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
style={tailwind()} vs className #2
Comments
|
The benefit of having a simple function that returns native styles is that you're free to use it however and wherever you want. Having a |
Can I disagree little? I know that is a lot of work. But many projects are using mono repo or react-native-web to make ReactJS and react-native work side-by-side. className will enable us to work in a very consistent manner. |
@Faisal-Manzer In that case I think it's up to React Native to introduce this change first, not each individual library, otherwise it'll never become standard. |
I think it's an interesting point. As a React dev new to the react-native world and I was hoping to find something that would allow me to write my universal component styles like this
Where
Coupled with responsive tailwind classes support, this would make of your lib a no brainer choice for all the tailwind fan boys, like me, that wish to use react-native. 😄 |
Could you reopen the issue, please ? @vadimdemedes I wish the same thing as @gablabelle, how could we reuse components as much as possible between It would be really cool, if we could develop with the web version with something like |
Just an addition to this: In my tests, passing the import React from 'react';
import { View } from 'react-native'
import tailwind from 'tailwind-rn';
export default function AppView (props) {
const className = props.className
return (
<View
{...props}
style={{ ...props['style'], ...tailwind(className)}}
>
{props.children}
</View>
)
} And in order to use it I can do: import AppView from './app_view'
export default function App() {
return (
<AppView style={styles.container}>
<AppView className="w-64 bg-purple-400 h-60 p-6 rounded-xl">
<Text>Simple colored background</Text>
</AppView>
</AppView>
)
} |
Is there a reason why you chose to do this implementation vs className?
vs
The text was updated successfully, but these errors were encountered: