Skip to content
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

change theme don't effective #300

Closed
Torstentjh opened this issue May 30, 2024 · 5 comments
Closed

change theme don't effective #300

Torstentjh opened this issue May 30, 2024 · 5 comments

Comments

@Torstentjh
Copy link

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?😭

@jaredh159
Copy link
Owner

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

@Torstentjh
Copy link
Author

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😵‍💫

@Torstentjh
Copy link
Author

@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

@jaredh159
Copy link
Owner

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.

@jaredh159
Copy link
Owner

closing in favor of #112

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

No branches or pull requests

2 participants