You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This Library contains a driver which enables to use localforage for React-Native's AsyncStorage.
Peer Dependencies
Please note! With the switch to v3.0.0 @react-native-async-storage/async-storage became a peer dependency!!
Setup
Simply install the driver via NPM:
npm i --save @aveq-research/localforage-asyncstorage-driver
If not done yet, make sure to have the appropriate peer dependencies (react resp. react-native) to be installed.
Usage
It delivers three different methods to create an appropriate driver:
driverWithoutSerialization(): Create a common AsyncStorage driver which does not serialize any data automatically; you need to integrate your own serialization!
driverWithSerialization(serializer): Creates an AsyncStorage driver with the given serializer; A valid serializer needs to contain a serialize and deserialize method
driverWithDefaultSerialization(): Will use the default serialization from localforage
Working Code Example:
import{driverWithoutSerialization}from'@aveq-research/localforage-asyncstorage-driver';constdriver=driverWithoutSerialization();awaitlocalforage.defineDriver(driver);awaitlocalforage.setDriver(driver._driver);// i.e. "rnAsyncStorageWrapper"