Skip to content

An opinionated toast component for React.

Initialize with prop first (#99)

Emil Kowalski3e2adfb17fc3
diff --git a/src/index.tsx b/src/index.tsx
index dc05660..6bb7dc9 100644
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -383,7 +383,9 @@ const Toaster = (props: ToasterProps) => {
const [expanded, setExpanded] = React.useState(false);
const [interacting, setInteracting] = React.useState(false);
const [actualTheme, setActualTheme] = React.useState(
- typeof window !== 'undefined'
+ theme !== 'system'
+ ? theme
+ : typeof window !== 'undefined'
? window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches
? 'dark'
: 'light'