expo-font
Version: 55.0.4 Load custom fonts at runtime and use them in React Native components. Supports TTF, OTF, and web fonts with automatic loading and caching.Installation
Usage
API Reference
useFonts Hook
(fontMap: FontSource) => [boolean, Error | null]
Loads fonts and returns loading stateReturns
[loaded, error] tuple:loaded:truewhen fonts are loadederror: Error object if loading failed
loadAsync Method
(fontMap: FontSource) => Promise<void>
Loads fonts asynchronously
(fontFamily: string) => boolean
Checks if a font is loaded
(fontFamily: string) => boolean
Checks if a font is currently loading
FontSource Type
Examples
Basic Font Loading
With Splash Screen
Load Remote Fonts
Multiple Font Weights
Error Handling
Programmatic Loading
Check Font Status
Google Fonts Integration
Use with@expo-google-fonts:
Custom Font Hook
Config Plugin
Embed fonts in native projects: app.json:TypeScript
Platform Support
Best Practices
- Keep Splash Screen: Use
expo-splash-screenwhile fonts load - Subset Fonts: Only include needed characters to reduce file size
- Preload Critical Fonts: Load essential fonts during app initialization
- Handle Errors: Always check for font loading errors
- Use Font Weights: Load separate files for different weights rather than relying on synthetic bold