mirror of
https://github.com/hanzoai/gui.git
synced 2026-10-25 02:31:41 +00:00
The loader and the Next plugin only existed to drive webpack; Next runs on Turbopack and Vite has its own plugin. kitchen-sink and the integration app serve through vite, the optimizer suite drops the webpack name, and its fixture packages join the workspace so a fresh checkout links @my/ui.
34 lines
792 B
TypeScript
34 lines
792 B
TypeScript
import { useColorScheme } from 'react-native'
|
|
import {
|
|
CustomToast,
|
|
GuiProvider,
|
|
type GuiProviderProps,
|
|
ToastProvider,
|
|
config,
|
|
isWeb,
|
|
} from '@my/ui'
|
|
import { ToastViewport } from './ToastViewport'
|
|
|
|
export function Provider({
|
|
children,
|
|
defaultTheme = 'light',
|
|
...rest
|
|
}: Omit<GuiProviderProps, 'config'> & { defaultTheme?: string }) {
|
|
const colorScheme = useColorScheme()
|
|
const theme = defaultTheme || (colorScheme === 'dark' ? 'dark' : 'light')
|
|
|
|
return (
|
|
<GuiProvider config={config} defaultTheme={theme} {...rest}>
|
|
<ToastProvider
|
|
swipeDirection="horizontal"
|
|
duration={6000}
|
|
native={isWeb ? [] : ['mobile']}
|
|
>
|
|
{children}
|
|
<CustomToast />
|
|
<ToastViewport />
|
|
</ToastProvider>
|
|
</GuiProvider>
|
|
)
|
|
}
|