Encrypted-Chat-Client/app/Provider.tsx
2024-12-15 06:40:35 -08:00

34 lines
1.0 KiB
TypeScript

import { useColorScheme } from 'react-native'
import { TamaguiProvider, type TamaguiProviderProps } from 'tamagui'
import { ToastProvider, ToastViewport } from '@tamagui/toast'
import { CurrentToast } from './CurrentToast'
import { config } from '../tamagui.config'
import {useRouter} from "expo-router"
export function Provider({ children, ...rest }: Omit<TamaguiProviderProps, 'config'>) {
const colorScheme = useColorScheme()
return (
<TamaguiProvider
config={config}
defaultTheme={colorScheme === 'dark' ? 'dark' : 'light'}
{...rest}
>
<ToastProvider
swipeDirection="horizontal"
duration={6000}
native={
[
/* uncomment the next line to do native toasts on mobile. NOTE: it'll require you making a dev build and won't work with Expo Go */
// 'mobile'
]
}
>
{children}
<CurrentToast />
<ToastViewport top="$8" left={0} right={0} />
</ToastProvider>
</TamaguiProvider>
)
}