Massive/use-theme.ts

23 lines
586 B
TypeScript
Raw Normal View History

2023-06-27 03:16:59 +00:00
import { createContext, useContext } from 'react'
import { DarkTheme, DefaultTheme } from 'react-native-paper'
export const ThemeContext = createContext<{
theme: string
lightColor: string
setTheme: (value: string) => void
setLightColor: (value: string) => void
darkColor: string
setDarkColor: (value: string) => void
}>({
theme: 'system',
lightColor: DefaultTheme.colors.primary,
setTheme: () => null,
setLightColor: () => null,
darkColor: DarkTheme.colors.primary,
setDarkColor: () => null,
})
export function useTheme() {
return useContext(ThemeContext)
}