Learn how to manage images, fonts, and other static assets in your Expo project.
Assets are static files like images, fonts, videos, and other media that your app uses. Expo provides built-in support for managing these assets.
By convention, assets are stored in the assets/ directory:
assets/
├── images/
│ ├── icon.png
│ ├── splash-icon.png
│ └── logo.png
├── fonts/
│ ├── Inter-Regular.ttf
│ └── Inter-Bold.ttf
└── ...
Import images directly in your code:
import { Image } from 'react-native';
export default function App() {
return (
<Image
source={require('./assets/images/logo.png')}
style={{ width: 100, height: 100 }}
/>
);
}You can also load images from URLs:
<Image
source={{ uri: 'https://example.com/image.png' }}
style={{ width: 100, height: 100 }}
/>Expo supports:
- PNG - Best for images with transparency
- JPEG - Best for photos
- WebP - Modern format with good compression
- SVG - Vector graphics (requires
react-native-svg)
- Use Appropriate Formats: PNG for transparency, JPEG for photos
- Optimize File Size: Compress images before adding to project
- Provide Multiple Sizes: Use
@2xand@3xvariants for retina displays - Lazy Load: Load images only when needed
For different screen densities:
assets/
├── images/
│ ├── logo.png # 1x
│ ├── logo@2x.png # 2x
│ └── logo@3x.png # 3x
React Native automatically selects the appropriate image based on device density.
See Fonts Guide for detailed information about adding custom fonts.
npx expo install expo-avimport { Video } from 'expo-av';
import { useRef } from 'react';
export default function App() {
const videoRef = useRef<Video>(null);
return (
<Video
ref={videoRef}
source={require('./assets/videos/intro.mp4')}
style={{ width: 300, height: 200 }}
useNativeControls
resizeMode="contain"
/>
);
}npx expo install expo-avimport { Audio } from 'expo-av';
import { useEffect } from 'react';
export default function App() {
useEffect(() => {
const playSound = async () => {
const { sound } = await Audio.Sound.createAsync(
require('./assets/audio/notification.mp3')
);
await sound.playAsync();
};
playSound();
}, []);
return null;
}Preload assets for better performance:
import { Asset } from 'expo-asset';
const loadAssets = async () => {
const images = [
require('./assets/images/logo.png'),
require('./assets/images/icon.png'),
];
await Asset.loadAsync(images);
};import { Asset } from 'expo-asset';
const asset = Asset.fromModule(require('./assets/images/logo.png'));
const status = await asset.downloadAsync();See Splash Screen and App Icon Guide for detailed information.
- Organize by Type: Group assets by type (images, fonts, videos)
- Optimize File Sizes: Compress images and videos before adding
- Use Appropriate Formats: Choose formats based on use case
- Provide Multiple Resolutions: Include @2x and @3x variants
- Lazy Load Large Assets: Load heavy assets only when needed
- Cache Remote Assets: Cache remote images for offline access