Overview
Efficient asset management improves app performance and reduces bundle size. This guide covers asset optimization, loading strategies, and best practices.Asset Types
Images
Fonts
Videos
Audio
Project Structure
Recommended layout
Image Optimization
Image formats
- WebP
- PNG
- JPG
Best for photos with transparency:Pros:
- 25-35% smaller than PNG/JPG
- Supports transparency
- Good quality
- Not supported in very old devices
Image dimensions
Responsive images
components/ResponsiveImage.tsx
expo-image
Useexpo-image for better performance:
- Native caching
- Smooth transitions
- Blurhash placeholders
- Better performance
- WebP support
Image Caching
Preload images
hooks/usePreloadImages.ts
Clear cache
Blurhash Placeholders
Font Management
Load fonts
app/_layout.tsx
Use fonts
Font variants
Instead of multiple font files:Asset Bundling
app.json configuration
app.json
assets/ are bundled with your app.
Exclude assets
Remote Assets
CDN strategy
utils/cdn.ts
Progressive loading
components/ProgressiveImage.tsx
Asset Optimization Tools
ImageOptim (macOS)
Sharp (Node.js)
scripts/optimize-images.js
FFmpeg (Video)
Vector Graphics
React Native SVG
components/Logo.tsx
- Scales perfectly
- Small file size
- Customizable colors
- No multiple resolution files needed
Asset Security
Protect sensitive assets
Watermarking
Best Practices
General
- Optimize before adding: Compress images before committing
- Use appropriate formats: WebP for photos, PNG for graphics, SVG for icons
- Lazy load: Load assets when needed, not upfront
- Cache aggressively: Use
expo-imagecaching - CDN for large assets: Host videos and large images on CDN
- Version assets: Add version/hash to remote asset URLs for cache busting
Images
- Multiple resolutions: Provide @2x and @3x variants
- Responsive sizing: Load appropriate size for display dimensions
- Compression: Balance quality vs file size (80-85% quality is usually good)
- Dimensions: Don’t load 4K images for thumbnails
Fonts
- Load only what you use: Don’t load all font weights
- System fonts: Consider using built-in system fonts
- Subset fonts: Remove unused glyphs for smaller file size
Troubleshooting
Images not loading
Images not loading
- Check file path is correct
- Verify image is in assetBundlePatterns
- Clear Metro cache:
npx expo start --clear - For remote images, check URL is accessible
Fonts not applying
Fonts not applying
- Ensure fonts are loaded before rendering
- Check font family name matches loaded font key
- Rebuild app after adding new fonts
Large bundle size
Large bundle size
- Analyze assets with
npx expo-atlas - Compress images with tools like ImageOptim
- Use WebP format
- Move large assets to CDN
Slow image loading
Slow image loading
- Preload critical images
- Use appropriate image sizes
- Enable caching with
expo-image - Consider using progressive loading
Asset Checklist
- All images compressed and optimized
- Using WebP format where appropriate
- Multiple resolutions provided (@1x, @2x, @3x)
- Images are appropriate size for display
- Fonts loaded before app renders
- Only necessary fonts included
- Large assets hosted on CDN
- Asset caching configured
- Placeholders for images
- SVG used for icons where possible