mirror of
https://github.com/Jellify-Music/App.git
synced 2026-05-07 03:49:25 -05:00
theme toasts better
This commit is contained in:
@@ -1,28 +1,30 @@
|
||||
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 {
|
||||
const currentToast = useToastState()
|
||||
|
||||
if (!currentToast || currentToast.isHandledNatively) return null
|
||||
return (
|
||||
<TamaguiToast
|
||||
key={currentToast.id}
|
||||
duration={currentToast.duration}
|
||||
enterStyle={{ opacity: 0, scale: 0.5, y: -25 }}
|
||||
exitStyle={{ opacity: 0, scale: 1, y: -20 }}
|
||||
y={0}
|
||||
opacity={1}
|
||||
scale={1}
|
||||
animation="100ms"
|
||||
viewportName={currentToast.viewportName}
|
||||
>
|
||||
<YStack>
|
||||
<TamaguiToast.Title>{currentToast.title}</TamaguiToast.Title>
|
||||
{!!currentToast.message && (
|
||||
<TamaguiToast.Description>{currentToast.message}</TamaguiToast.Description>
|
||||
)}
|
||||
</YStack>
|
||||
</TamaguiToast>
|
||||
<Theme name="inverted_purple">
|
||||
<TamaguiToast
|
||||
key={currentToast.id}
|
||||
duration={currentToast.duration}
|
||||
enterStyle={{ opacity: 0, scale: 0.5, y: -25 }}
|
||||
exitStyle={{ opacity: 0, scale: 1, y: -20 }}
|
||||
y={0}
|
||||
opacity={1}
|
||||
scale={1}
|
||||
animation="200ms"
|
||||
viewportName={currentToast.viewportName}
|
||||
>
|
||||
<YStack>
|
||||
<TamaguiToast.Title>{currentToast.title}</TamaguiToast.Title>
|
||||
{!!currentToast.message && (
|
||||
<TamaguiToast.Description>{currentToast.message}</TamaguiToast.Description>
|
||||
)}
|
||||
</YStack>
|
||||
</TamaguiToast>
|
||||
</Theme>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user