31 lines
771 B
TypeScript
31 lines
771 B
TypeScript
import { Toaster as SonnerToaster } from "sonner-native"
|
|
import { useColorScheme } from "react-native"
|
|
|
|
import { colors, radius } from "@/lib/theme"
|
|
|
|
export function Toaster() {
|
|
const scheme = useColorScheme()
|
|
const themeColors = scheme === "dark" ? colors.dark : colors.light
|
|
|
|
return (
|
|
<SonnerToaster
|
|
position="top-center"
|
|
theme={scheme === "dark" ? "dark" : "light"}
|
|
toastOptions={{
|
|
style: {
|
|
backgroundColor: themeColors.card,
|
|
borderColor: themeColors.border,
|
|
borderWidth: 1,
|
|
borderRadius: radius.lg,
|
|
},
|
|
titleStyle: {
|
|
color: themeColors.foreground,
|
|
},
|
|
descriptionStyle: {
|
|
color: themeColors.mutedForeground,
|
|
},
|
|
}}
|
|
/>
|
|
)
|
|
}
|