Dark mode preference doesn't apply when using "Auto" system preference
brianlovin opened this issue · 2 comments
This hooks is great, I've recently implemented it on my site https://brianlovin.com. I've noticed that if I want the dark mode setting to be entirely based on the user's OS (e.g. I don't include a toggle on the page), that things break if the user is using the automatic dark mode setting on their OS.
Bug:
- set your macOS / iOS preferences to turn on dark mode at sunset, off at sunrise
- open any app (or my site) before sunset - you should see day mode
- open again after sunset - you will still see day mode
I'm wondering if there could be a refetchUserPreference
method or something that is exposed from the hook which I could run in my own code in an effect or just on-mount that would help people who visit the site between OS setting switches.
Just wondering: this would work automatically if we had a method to disable the use of localStorage, right?
Facepalm:
A string that will be used by the storageProvider to persist the dark mode value. If you specify a value of null, nothing will be persisted. Default = darkMode.