mirror of
https://github.com/Jellify-Music/App.git
synced 2026-05-08 04:19:34 -05:00
theme toasts better
This commit is contained in:
@@ -1,28 +1,30 @@
|
|||||||
import {Toast as TamaguiToast, useToastState} from "@tamagui/toast"
|
import {Toast as TamaguiToast, useToastState} from "@tamagui/toast"
|
||||||
import { YStack } from "tamagui"
|
import { Theme, YStack } from "tamagui"
|
||||||
|
|
||||||
export default function Toast() : React.JSX.Element | null {
|
export default function Toast() : React.JSX.Element | null {
|
||||||
const currentToast = useToastState()
|
const currentToast = useToastState()
|
||||||
|
|
||||||
if (!currentToast || currentToast.isHandledNatively) return null
|
if (!currentToast || currentToast.isHandledNatively) return null
|
||||||
return (
|
return (
|
||||||
<TamaguiToast
|
<Theme name="inverted_purple">
|
||||||
key={currentToast.id}
|
<TamaguiToast
|
||||||
duration={currentToast.duration}
|
key={currentToast.id}
|
||||||
enterStyle={{ opacity: 0, scale: 0.5, y: -25 }}
|
duration={currentToast.duration}
|
||||||
exitStyle={{ opacity: 0, scale: 1, y: -20 }}
|
enterStyle={{ opacity: 0, scale: 0.5, y: -25 }}
|
||||||
y={0}
|
exitStyle={{ opacity: 0, scale: 1, y: -20 }}
|
||||||
opacity={1}
|
y={0}
|
||||||
scale={1}
|
opacity={1}
|
||||||
animation="100ms"
|
scale={1}
|
||||||
viewportName={currentToast.viewportName}
|
animation="200ms"
|
||||||
>
|
viewportName={currentToast.viewportName}
|
||||||
<YStack>
|
>
|
||||||
<TamaguiToast.Title>{currentToast.title}</TamaguiToast.Title>
|
<YStack>
|
||||||
{!!currentToast.message && (
|
<TamaguiToast.Title>{currentToast.title}</TamaguiToast.Title>
|
||||||
<TamaguiToast.Description>{currentToast.message}</TamaguiToast.Description>
|
{!!currentToast.message && (
|
||||||
)}
|
<TamaguiToast.Description>{currentToast.message}</TamaguiToast.Description>
|
||||||
</YStack>
|
)}
|
||||||
</TamaguiToast>
|
</YStack>
|
||||||
|
</TamaguiToast>
|
||||||
|
</Theme>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user