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

[3.0.0-beta.1] adaptive themes not working when destructuring theme object #415

Open
ngocle2497 opened this issue Dec 11, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@ngocle2497
Copy link
Contributor

Description

I create new project then add this library. I turn adaptiveThemes on.
I create stylesheet like this:

const styles = StyleSheet.create(({colors}, {screen: {width}}) => ({
  container: {
    paddingHorizontal: 16,
    rowGap: 5,
  },
  fill: {
    flex: 1,
  },
  row: {
    flexDirection: 'row',
    columnGap: 5,
  },
  box: {
    width: (width - 32 - 7 * 5) / 8,
    height: (width - 32 - 7 * 5) / 8,
    backgroundColor: colors.accent,
  },
}));

when switch os theme. UI not update. But when I use:

StyleSheet.create((theme

instead :

StyleSheet.create(({colors}

It's working.

Steps to Reproduce

You can clone repo then follow this video:

Screen.Recording.2024-12-11.at.17.34.30.mov

Snack or Repository Link (Optional)

https://github.com/ngocle2497/Unistyles-issue-adaptiveThemes

Unistyles Version

3.0.0-beta.1

React Native Version

0.76.5

Platforms

iOS

Expo

None

@jpudysz
Copy link
Owner

jpudysz commented Dec 11, 2024

Hey 👋🏼 this is currently not supported in babel plugin. You need to use theme or rt directly to detect dependencies. It can be improved so I will keep it as a reference.

@jpudysz jpudysz added this to the 3.0.0-beta.3 milestone Dec 11, 2024
@jpudysz jpudysz added the enhancement New feature or request label Dec 13, 2024
@jpudysz jpudysz removed this from the 3.0.0-beta.3 milestone Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants