Reputation: 41
I have a problem in react native app I want to add clear cache option in react native app for users to clear app cache when they want to clear basically my app is wallpapers app.
Upvotes: 4
Views: 3775
Reputation: 499
For RN 0.60 and above, I am using yarn add oa-react-native-clear-cache or npm install oa-react-native-clear-cache
usage:
import ClearCache from 'oa-react-native-clear-cache'
ClearCache.getAppCacheSize((value, unit) => {
console.log("cache size", value, unit) // check size
ClearCache.clearAppCache(() => {}) // clear cache
})
Upvotes: 2
Reputation: 2972
You can use react-native-clear-app-cache to do this
install with:
npm install --save react-native-clear-app-cache
Link with:
react-native link react-native-clear-app-cache
Use as follow:
import clearCacheModuleObj from '
react-native-clear-app-cache '
[...]
clearCacheModuleObj.clearAppCache()
[...]
Also, i didn't used this module so maybe this doesn't work. Debugging has to be made.
Upvotes: 1