react-native - 在反应本机应用程序中添加清除缓存选项
问题描述
我在反应本机应用程序中遇到问题我想在反应本机应用程序中添加清除缓存选项,以便用户在他们想要清除基本上我的应用程序是壁纸应用程序时清除应用程序缓存。
解决方案
对于 RN 0.60 及更高版本,我使用 yarn add oa-react-native-clear-cache或 npm install oa-react-native-clear-cache
用法:
从 'oa-react-native-clear-cache' 导入 ClearCache
ClearCache.getAppCacheSize((value, unit) => {
console.log("cache size", value, unit) // check size
ClearCache.clearAppCache(() => {}) // clear cache
})