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

fix initial value of app color scheme #267

Closed
wants to merge 1 commit into from

Conversation

jaredh159
Copy link
Owner

No description provided.

);
const [colorScheme, setColorScheme] = useState(() => {
const init = initialValue ?? Appearance.getColorScheme();
tw.setColorScheme(init);
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here's the key (really, only) change -- we set the initial value into the tw object immediately, but only once (by leveraging a react initializer function).

@jaredh159
Copy link
Owner Author

No description provided.

@jaredh159
Copy link
Owner Author

closing in favor of #271

@crjc i've got a PR up with my proposed changes, would you mind taking a quick look? #271

instructions for migrating (docs on breaking changes) here: https://github.com/jaredh159/tailwind-react-native-classnames/blob/f1997ae17273f35b31d446ff03dae2697e650414/migration-guide.md

you can test it by installing a beta release with npm install twrnc@next

@jaredh159 jaredh159 closed this Feb 12, 2024
@crjc
Copy link
Contributor

crjc commented Feb 12, 2024

Looks good to me!

@jaredh159
Copy link
Owner Author

thanks for checking it out. going to do a little more testing, then probably go with it. 👍

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