You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The example in src/main.tsx for setting dark mode doesn't use a clean-up function inside the useEffect when adding event listener.
useEffect(()=>{// Listen for changes to the prefers-color-scheme media queryprefersDark.addEventListener('change',(mediaQuery)=>initializeDarkPalette(mediaQuery.matches));},[]);
This would just continuously add listeners.
This would fix the issue.
useEffect(()=>{// Listen for changes to the prefers-color-scheme media queryprefersDark.addEventListener('change',funct);return()=>{prefersDark.removeEventListener('change',funct);}},[]);
The text was updated successfully, but these errors were encountered:
URL
https://ionicframework.com/docs/theming/dark-mode#css-class
Issue Description
The example in
src/main.tsx
for setting dark mode doesn't use a clean-up function inside theuseEffect
when adding event listener.This would just continuously add listeners.
This would fix the issue.
The text was updated successfully, but these errors were encountered: