本地缓存插件,可以在ios端进行查看容量,及清空缓存.
npm install react-native-localcache#react-native-localcache
> 本地缓存插件,可以在ios端进行查看容量,及清空缓存.

import Localcache from 'react-native-localcache';
export default class extends Component {
constructor() {
super();
this.state = {};
}
componentDidMount() {
this.getData();
}
async getData() {
const _all = await Localcache.getSize();
this.setState({
all: Math.ceil(_all / 1024 / 1024 * 100) / 100
});
}
render(){
return(
{this.state.all}
)
}}
const styles = StyleSheet.create({
list: {
backgroundColor: '#fff', marginBottom: 10
},
title: {color: '#666', padding: 10}
});
`API
`
import Localcache from 'react-native-localcache';
``