u
This commit is contained in:
1 parent
4274b26dd9
commit
f28107399e
183 files changed
+32632
-20013
No files matched your search
@@ -2,22 +2,20 @@ import AsyncStorage from '@react-native-async-storage/async-storage'
|
||||
import { create } from 'zustand'
|
||||
import { createJSONStorage, persist } from 'zustand/middleware'
|
||||
|
||||
export type ThemeScheme = 'light' | 'dark' | 'auto'
|
||||
|
||||
interface AppState {
|
||||
themeScheme: ThemeScheme
|
||||
setThemeScheme: (theme: ThemeScheme) => void
|
||||
}
|
||||
|
||||
export const useAppStore = create<AppState>()(
|
||||
persist(
|
||||
set => ({
|
||||
themeScheme: 'auto',
|
||||
setThemeScheme: theme => set({ themeScheme: theme }),
|
||||
}),
|
||||
{
|
||||
name: 'app-storage',
|
||||
storage: createJSONStorage(() => AsyncStorage),
|
||||
},
|
||||
),
|
||||
)
|
||||
// export const useAppStore = create<AppState>()(
|
||||
// persist(
|
||||
// set => ({
|
||||
// themeScheme: 'system',
|
||||
// setThemeScheme: theme => set({ themeScheme: theme }),
|
||||
// }),
|
||||
// {
|
||||
// name: 'app-storage',
|
||||
// storage: createJSONStorage(() => AsyncStorage),
|
||||
// },
|
||||
// ),
|
||||
// )
|
||||
Reference in new issue
Block a user