Registry /
storage / react-native-expo-image-cache
Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Image
✓ import { Image } from 'react-native-expo-image-cache'
✗ const Image = require('react-native-expo-image-cache').Image
ESM named import is correct. Default import is not supported. TypeScript types are included.
CacheManager
✓ import { CacheManager } from 'react-native-expo-image-cache'
✗ import CacheManager from 'react-native-expo-image-cache'
Named import only. CacheManager is a singleton with methods get() and clearCache().
type ImageProps
✓ import { Image } from 'react-native-expo-image-cache'; type MyProps = Image['props']
✗ import { ImageProps } from 'react-native-expo-image-cache'
No direct export of ImageProps; infer from Image component. Available in TypeScript types.
Shows import of Image and CacheManager, usage of Image component with preview and uri props, and async retrieval of cached file path.
import { Image, CacheManager } from 'react-native-expo-image-cache';
const preview = { uri: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==' };
const uri = 'https://example.com/image.png';
export const CachedImage = () => (
<Image style={{ height: 100, width: 100 }} {...{preview, uri}} />
);
// Optional: get local path
const getPath = async () => {
const path = await CacheManager.get(uri).getPath();
console.log(path);
};
Errors
Common errors & fixes
Module not found: Can't resolve 'react-native-expo-image-cache'
Package not installed or missing peer dependencies.
fixRun: yarn add react-native-expo-image-cache expo-blur expo-file-system
You attempted to set a key 'uri' on a non-object. Check the render method of Image.
Incorrect spread of props object. {...{preview, uri}} is correct, not {...preview, uri}.
fixUse {...{preview, uri}} or pass preview={preview} uri={uri} directly. TypeError: undefined is not an object (evaluating 'path.length')
CacheManager.get(uri).getPath() returned undefined because download failed.
fixWrap in if (path) { ... } and ensure the remote URI is accessible. Possible Unhandled Promise Rejection: Error: Cannot read property 'getInfoAsync' of null
expo-file-system not installed or improperly linked.
fixInstall expo-file-system and run expo install expo-file-system.
Audit
Dependencies
expo-blurrequiredPeer dependency for image blur effect
expo-file-systemrequiredPeer dependency for caching images
reactrequiredPeer dependency
react-nativerequiredPeer dependency