nativewind / nativewind

React Native utility-first universal design system - powered by Tailwind CSS
https://nativewind.dev
MIT License
4.52k stars 242 forks source link

Dark theme doesn't change for elements. #960

Closed shawnmclean closed 1 day ago

shawnmclean commented 3 days ago

I've been trying to setup a mono repo with shared components.

So far I have nextjs being able to change the theme correctly.

But on expo, the RN elements are not updating or switching over to dark mode.

Does anyone know how this works? When themes are switched, what happens in react native? Top level style changes or all components rebuilds?

Repro: https://github.com/shawnmclean/sovoli

ws-rush commented 3 days ago

you need add it explicitly for every item, react-native in general doesn't inherit CSS styles, so you should add for every element text-black dark:text-white

shawnmclean commented 3 days ago

I was looking at the rn-reusables showcase demo and I'm using the same components as them.

I don't see anything special going on with the components.

I ran their project and it works, the expo mobile theme switches, so comparing my setup and theirs, I'm not sure I'm spotting the difference.

shawnmclean commented 1 day ago

I ran into a tailwing config merging issue.

The solution was to ensure that darkMode: class is at the root config, see comment: https://github.com/shawnmclean/sovoli/commit/e8f2fb970efda864c63b088b957d642a5ad7b80e#r143727607