An opinionated toast component for React.
fix system theme (#126)
Emil Kowalski5ec8990e931e
diff --git a/src/index.tsx b/src/index.tsxindex 906dba9..894749d 100644--- a/src/index.tsx+++ b/src/index.tsx@@ -455,6 +455,17 @@ const Toaster = (props: ToasterProps) => {return;}+ if (theme === 'system') {+ // check if current preference is dark+ if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {+ // it's currently dark+ setActualTheme('dark');+ } else {+ // it's not dark+ setActualTheme('light');+ }+ }+if (typeof window === 'undefined') return;window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', ({ matches }) => {