question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ThemeProvider breaks react-storybook

See original GitHub issue

I’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:

demo

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:closed
  • Created 7 years ago
  • Comments:17 (8 by maintainers)

github_iconTop GitHub Comments

8reactions
vernondegoedecommented, Jan 13, 2017

Yes, it’s working fine. Just use the addDecorator method which comes with react-storybook.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found