React Native Image Cache, Progressive Loading, Zoom, Loading Indicator based on Expo
This package has a peer dependency with React, React Native, and Expo.
npm install expo-smart-image
import { Image } from "expo-smart-image";
Props | Default | Options |
---|---|---|
tint | dark | light, dark, default |
transitionDuration | 300 | custom in ms |
enableLoadingIndicator | true | true, false |
enableZoom | true | true, false |
loadingIndicatorStyle={{
backgroundStrokeColor: 'rgba(255, 255, 255, 0.5)',
strokeColor: '#FFFFFF',
strokeWidth: 3,
size: 300,
}}
Get the local image from a remote URI
import {CacheManager} from "expo-smart-image";
const {uri} = this.props;
const path = await CacheManager.get(uri).getPath();
// if path is undefined, the image download has failed
You can also clear the local cache:
import {CacheManager} from "expo-smart-image";
await CacheManager.clearCache();
See the contributing guide to learn how to contribute to the repository and the development workflow.
MIT