Skip to content

feat: web support #195

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

Gregoirevda
Copy link

I managed to make this work for web in an easy way, which doesn't require an impact on native

Say your web app already uses tailwind.

function Page() {
  return <div className="flex-1">
    <SharedComponent />
  </div>
)

And you would like to share a component between your RN app and ReactJS app:

import {View} from 'react-native-web';
import {useTailwind) from 'tailwind-rn'

function SharedComponent() {
 const tw = useTailwind();
  return <View style={tw('bg-red-500 w-full h-16')} />
} 

For native, nothing changes, but for web it pass the tailwind CSS classnames to RNW (which requires a $$css flag)

I have a babel plugin which makes it work for SVG imported with react-native-svg-transformer plugin, but already wanted to know your opinion on this?

@Gregoirevda
Copy link
Author

I think this can be useful because the only current solution for cross platform is nativewind, but I miss using this library which worked so well

@maciej-czekala
Copy link

Great idea! It would be cool to have web support out of the box.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants