Chakra UI Dark Mode White Screen Flash
See original GitHub issueWhen I run the nextjs-typescript example when you click on different pages on Dark Mode the screen will flash with a white before loading the page. It’s not as bad as typing in the URL manually but it’s still quite jarring. Any ideas how I can fix this?
Thanks!
Steps to reproduce:
Clone nextjs-typescript
npm i framer-motion
npm run dev
- Click on
View Properties
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:12 (2 by maintainers)
Top Results From Across the Web
Color Mode - Chakra UI
Color Mode. Chakra UI comes with built-in support for managing color mode in your apps. By default, most of Chakra's components are dark...
Read more >Chakra UI colormode issue (white flashes) - TrueQ
WIth Chakra UI there is an issue which results in white flashes when reloading/loading a statically rendered page with their dark mode ......
Read more >Flashless Chakra UI - npm
This library contains all the tools necessary to implement Chakra UI color modes on statically rendered websites without the flash.
Read more >Color Mode - Chakra UI
When you use the ChakraProvider at the root of your app, you can automatically use color mode in your apps. By default, most...
Read more >Fixing the dark mode flash issue on server rendered websites
There's one last update to be done: updating the toggle light/dark mode function. We need to add a few lines of code to...
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
I think I’ve fixed it, if you import Chakra in _app.tsx it seems to fix it.
import {Chakra} from '../Chakra';
and then wrap the component in it:
<Chakra><Component {...pageProps} /></Chakra>
For React Users (no SSR)
Add this script below the body of index.html
You might want to specify the correct color for each mode.