-
Notifications
You must be signed in to change notification settings - Fork 14
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
NativeWind support #26
Comments
Hi @freitagdavid, do you mind sharing your tailwind config and package.json? |
I've got my redux provider wrapped in a nativewind styled with a dark class on it. I've also tried putting the class directly on the component I'm styling but it's always coming back as undefined in the style object in react devtools. Here is my config, I was trying to do the minimum required to get it working. I'm currently working on getting tw into our project, gotta have simple theming to do that though. Tailwinds is definitely working got a screen themed but couldn't get tw-colors working. Edit: Forgot to mention I've got this setup using babel so I don't need to wrap everything.
Sadly I can't post my full package.json this is a project for work but here is a sanitized one I'm not sure exactly what is proprietary so I removed anything relating to my company but I think this covers what you would need.
|
I've done some further tinkering and it seems like at least vs code intellisense sees that bg-background is a twc variable so that definitely suggests to me that this might just be an issue with using this on a native platform, or with NativeWind itself. It could potentially be that my className isn't being applied properly but I'm unsure. Have you been able to think of any potentials? |
Didn't have time to work on it yet. I need to check if the following color definitions work in NativeWind without using tw-colors
And
If just the first one works, I might get tw-colors to work with NativeWind without supporting colors with a default opacity other than 1 If the second one also works, NativeWind might not have full support for all tailwind plugins features. I'll try to investigate it next week |
Thanks so much for the quick responses. If this can work with NativeWind it's gonna make my life so much easier. Goodbye 5000 line theme file haha. |
Fixed in version @freitagdavid you can say goodbye to your 5000 lines file 😏 |
This looks very promising, but I haven't quite been able to get it to work. Here's what I've tried:
When I inspect the resulting styles, the color being applied is |
Did you declare your theme in the markup?
You can also define a default theme in the options. Also make sire to use version 3.1.2 |
Just confirmed I'm on version 3.1.2. This is a React Native project, so I wasn't quite sure where to put
If I can get this working manually, I'm hoping to then get the value via the |
Try with
|
Unfortunately it's the same result, with the inspector showing a color of |
Can you share your package.json? |
|
I made some tests with an expo setup this time (the previous attempt was with a Next.js setup). I'm sorry to tell you that NativeWind 2 cannot be supported. NativeWind version 3 will not add support for it (see the :root CSS Variables / limitiations section). |
@L-Blondy Thank you for looking into this. It looks like setting CSS variables via the theme might be the way to achieve this in NativeWind v3:
|
Indeed, in this case tw-colors should not be used. I might add a nativewind specific export with light and dark themes only in some future version. Need to wait for NativeWind v3 anyways... |
any update on this... |
I've been trying and trying but no matter what I do I can't seem to get this working with NativeWind. I'm not sure if I'm doing something wrong or if this plugin just fundamentally wouldn't work. But it does precisely what I'm needing out of tailwind in my project.
Just thought I would ask, has this been tested in NativeWind?
The text was updated successfully, but these errors were encountered: