// stores/theme-store.ts import { create } from 'zustand'; import { persist, createJSONStorage } from 'zustand/middleware'; import AsyncStorage from '@react-native-async-storage/async-storage'; type Theme = 'light' | 'dark' | 'system'; interface ThemeState { theme: Theme; setTheme: (theme: Theme) => void; } export const useThemeStore = create()( persist( (set) => ({ theme: 'system', setTheme: (theme) => set({ theme }), }), { name: 'theme-storage', storage: createJSONStorage(() => AsyncStorage), } ) );