jaredh159 / tailwind-react-native-classnames

simple, expressive API for tailwindcss + react-native

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

change theme don't effective

Torstentjh opened this issue · comments

commented

hello,I am a newbie in react native. I have a problem and would like to ask if there is a good solution. I use the react-navigation/native library in my project. When I use toggleColorScheme or setColorScheme to change the theme in a child component, they will only change the color in the current component and will not change other components. Is there a good solution?😭

hi there! please have a look at #112 -- i think what you're encountering is that issue, you may need to break the memoization as described here: https://github.com/jaredh159/tailwind-react-native-classnames?tab=readme-ov-file#memo-busting

commented

hi there! please have a look at #112 -- i think what you're encountering is that issue, you may need to break the memoization as described here: https://github.com/jaredh159/tailwind-react-native-classnames?tab=readme-ov-file#memo-busting

Thanks a lot, I didn't notice that. sry😵‍💫

commented

@jaredh159 hello,I referred to the answer in the issue and only set memoBuster in the navigator, but it still didn't work. Is it related to my nested routes? But after I try to set this attribute on both the stack route and the bottom tab, the function of switching themes is completely invalid. I really can't figure out how to solve it
image

I'm not sure, you may have to set the memo buster on several components. as noted in that issue, this isn't really a solved problem yet, some people have gotten it to work with their react navigation hierarchy, others seem to not be able to.

closing in favor of #112