
Security News
New CVE Forecasting Tool Predicts 47,000 Disclosures in 2025
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.
react-native-image-cache-wrapper
Advanced tools
The best react native image cache wrapper.
<Image/>
and <ImageBackground/>
We use rn-fetch-blob
to handle file system access in this package,
So you should install react-native-image-cache-wrapper and rn-fetch-blob both.
npm install react-native-image-cache-wrapper --save
npm install rn-fetch-blob --save
react-native link rn-fetch-blob
or use yarn
yarn add react-native-image-cache-wrapper
yarn add rn-fetch-blob
v1.0.4
v1.0.3
v1.0.2
v1.0.0
Property | Type | Default | Description | FirstRelease |
---|---|---|---|---|
<Image/> or <ImageBackground> properties | same with <Image/> and <ImageBackground/> | 1.0 | ||
expiration | number | 604800 | expiration seconds (0:no expiration, default cache a week) | 1.0 |
activityIndicator | Component | null | when loading show it as an indicator, you can use your component | 1.0 |
import CachedImage from 'react-native-image-cache-wrapper';
render()
{
return (
<View>
<CachedImage source={{uri:"https://assets-cdn.github.com/images/modules/logos_page/Octocat.png"}}/>
<CachedImage source={{uri:"https://assets-cdn.github.com/images/modules/logos_page/Octocat.png"}}/>
<Text>This is example with image background.</Text>
</CachedImage>
</View>
);
}
CachedImage.getSize(url, success=(width,height)=>void,fail=(error)=>void)
Get the image size, if no cache, will cache it.
Example:
import CachedImage from 'react-native-image-cache-wrapper';
CachedImage.getSize("https://assets-cdn.github.com/images/modules/logos_page/Octocat.png",
(width,height)=>{
console.log("width:"+width+" height:"+height);
},(error)=>{
console.log("error:"+error);
});
CachedImage.prefetch(url,expiration=0,success=(cachFile)=>void,fail=(error)=>void)
prefetch an image and cache it.
Example:
import CachedImage from 'react-native-image-cache-wrapper';
// prefetch and cache image 3600 seconds
CachedImage.prefetch("https://assets-cdn.github.com/images/modules/logos_page/Octocat.png", 3600,
(cacheFile)=>{
console.log("cache filename:"+cacheFile);
},(error)=>{
console.log("error:"+error);
});
CachedImage.deleteCache(url)
delete a cache file.
Example:
import CachedImage from 'react-native-image-cache-wrapper';
// prefetch and cache image 3600 seconds
CachedImage.deleteCache("https://assets-cdn.github.com/images/modules/logos_page/Octocat.png");
CachedImage.clearCache()
clear all cache.
Example:
import CachedImage from 'react-native-image-cache-wrapper';
// prefetch and cache image 3600 seconds
CachedImage.clearCache();
FAQs
The best react native image cache wrapper.
The npm package react-native-image-cache-wrapper receives a total of 34 weekly downloads. As such, react-native-image-cache-wrapper popularity was classified as not popular.
We found that react-native-image-cache-wrapper demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.