Redux persist filesystem storage

Storage adaptor to use react-native-fetch-blob with redux-persist, by implementing the needed methods: setItem
, getItem
, removeItem
and getAllKeys
This storage can be used on Android to prevent issues with the storage limitations in the RN AsyncStorage implementation. (See redux-persist#199, redux-persist#284)
install
Simply run:
yarn add redux-persist-filesystem-storage
or
npm install --save redux-persist-filesystem-storage
usage
import FilesystemStorage from 'redux-persist-filesystem-storage'
import { persistStore, autoRehydrate } from 'redux-persist'
const store = createStore(reducer, undefined, autoRehydrate())
persistStore(
store,
{
storage: FilesystemStorage,
},
)
usage with custom options
import RNFetchBlob from 'react-native-fetch-blob'
import FilesystemStorage from 'redux-persist-filesystem-storage'
import { persistStore, autoRehydrate } from 'redux-persist'
const store = createStore(reducer, undefined, autoRehydrate())
persistStore(
store,
{
storage: FilesystemStorage.config(
{
storagePath: `${RNFetchBlob.fs.dirs.DocumentDir}/persistStore`,
},
},
)
)