Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

add clear cache option in react native app

Tags:

react-native

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.

like image 323
Wikram Das Avatar asked Oct 20 '25 16:10

Wikram Das


2 Answers

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  
})
like image 89
Shoma Avatar answered Oct 23 '25 08:10

Shoma


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.

like image 37
William Brochensque junior Avatar answered Oct 23 '25 07:10

William Brochensque junior



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!