A local storage wrapper for react-native and web apps, providing a unified API over AsyncStorage (React Native) and localStorage (browser). Version 1.0.1 is the latest stable release, with no active development since 2019. It uses ES6 syntax, promises for async loading, and supports memory caching, expiration, and automatic synchronization via custom sync methods. Key differentiators include cross-platform compatibility, configurable size limits, and typed API via TypeScript definitions.
npm install react-native-storageNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows initialization and basic save/load operations with async/await.
Use camelCase or hyphens instead of underscores.
Be aware of the FIFO eviction policy; plan key usage accordingly.
Use 'autoSync: true' with default behavior; avoid setting syncInBackground explicitly.
Always provide a storageBackend (AsyncStorage for RN, window.localStorage for web).
Set defaultExpires explicitly (e.g., to null) if you want persistent storage.
Replace import { Storage } from 'react-native-storage' with import Storage from 'react-native-storage'.Run npm install @react-native-community/async-storage and react-native link @react-native-community/async-storage.
Create an instance first: const storage = new Storage({...}) then call storage.save().Use sync method in constructor to provide a fallback, or handle NotFoundError in catch.