-
-
Notifications
You must be signed in to change notification settings - Fork 57
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
[v3] Storybook error #476
Comments
Hi, can you create repo with minimal reproduction? |
Hey @Brentlok, here's a example repo: https://github.com/jordmccord/unistyles-web-example If you get the storybook running via |
It seems to be when using |
I'm sorry I've updated the repo and removed the private package. Thank you, yes, I am seeing the styles as well when removing the variants; it was an oversight when writing the issue and debugging, I had tried an earlier alpha version of the library which had no error but the styles weren't applied. When using |
There is ongoing work to redesign variants here and I bet that it will resolve your issue once done. For now you can change your code to something like this: + import { Variants } from 'react-native-unistyles'
const Badge = forwardRef<View, BadgeProps>(({ children, ...props }, ref) => {
const {
colorScheme = "cyan",
size = "large",
strong = false,
borderless = false,
style,
...rest
} = props;
- styles.useVariants({ colorScheme, strong, size, borderless })
return (
+ <Variants variants={{ colorScheme, strong, size, borderless }}>
<View ref={ref} {...rest} style={[styles.container, style]}>
{children}
</View>
+ </Variants>
);
}); |
That did the trick, thanks, @Brentlok 🎉 Great work on the lib by the way. I'm looking forward to the next release. |
Should be resolved with #462 |
Description
When rendering a component with variants in Storybook I'm getting a
Variants is undefined
error.Steps to Reproduce
npx storybook@latest init
choosereact
andvite
.storybook/main.ts
to include the following:Snack or Repository Link (Optional)
No response
Unistyles Version
3.0.0-beta.4
React Native Version
0.76.5
Platforms
Web
Expo
Yes
The text was updated successfully, but these errors were encountered: