ThemeProvider breaks react-storybook
See original GitHub issueI’d appreciate any pointers as I’m not sure where things break down when using styled-components ThemProvider
with react-storybook. I only experience this problem when wrapping the styled
component in ThemeProvider
. I created a minimal example repo that demonstrates the problem I’m experiencing:
https://github.com/amsb/storybook_styled-components_example
Here’s what happens when I attempt to navigate in storybook after viewing a styled component wrapped in ThemeProvider
:
Same behavior if I remove the AddOn and directly wrap the component in ThemeProvider
in the story itself. Maybe some conflict with context management when using ThemeProvider
that blocks updates? There are no errors in the console.
Issue Analytics
- State:
- Created 7 years ago
- Comments:17 (8 by maintainers)
Top Results From Across the Web
React Theming Addon | Storybook: Frontend workshop for UI ...
Develop themes and themable components with Emotion, Styled Components, Material-UI and your custom solution.
Read more >MUI v5 + Storybook: Theme and font family do not work in ...
The simplest solution I found that worked is: import { ThemeProvider as MUIThemeProvider, createTheme } ...
Read more >Troubleshooting - Material UI - MUI
There are two reasons why component styles may be broken after you've completed all ... .storybook/preview.js import { ThemeProvider, createTheme } from ...
Read more >Adding decorators - theme support - Storybook for React Apps
import { ThemeProvider } from 'styled-components' import { DecoratorFn } from '@storybook/react' import { GlobalStyle } from '../src/styles/GlobalStyle'
Read more >Storybook & Atomic Design – 1.6. – Styling Our Button
Contribute to whatjackhasmade/storybook-atomic-design-react ... taps into the values we provided our ThemeProvider component at the start of ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@kopax https://gist.github.com/vernondegoede/0575d268d52e00f221cc86057fb938d1
Yes, it’s working fine. Just use the
addDecorator
method which comes with react-storybook.