everkit-state
v0.1.0
Published
Reusable client-state + persistence primitives for React Native / Expo apps: a SecureStore-to-Zustand StateStorage adapter and a composable preferences (theme + onboarding) slice. The storage backend is injected by the consumer, so the core stays pure and
Maintainers
Readme
everkit-state
Reusable client-state + persistence primitives for React Native / Expo apps. The storage backend is injected, so the core stays pure and testable outside a React Native runtime.
Exports
makeSecureStoreAdapter(api)→ ZustandStateStorage— a thin, pass-through bridge from a SecureStore-shaped API (getItemAsync/setItemAsync/deleteItemAsync) to Zustandpersist. Enforces the load-bearing contract:getItemresolvesnull(notundefined) on a miss and propagates errors;removeItemis idempotent.makeSecureJsonStorage(api)—createJSONStorage-wrapped adapter; whatpersist({ storage })consumes. Lazy, so importing it doesn't touch the native store at boot.createPreferencesSlice— a composable Zustand slice for the shared persisted shape:theme+hasCompletedOnboarding(+ setters). Spread into a bound store alongside app-specific runtime fields.pickPersistedPreferences(state)—partializehelper: persists onlytheme+hasCompletedOnboarding, dropping actions and foreign fields.ThemePreference—'light' | 'dark' | 'system'(owned here; re-exported by the theme package).
Peer dependencies
zustand >= 5
Test
npm test # node --require sucrase/register --test "src/**/__tests__/**/*.test.ts"