Overview
TheIconSymbol component provides a consistent icon experience across all platforms. It uses native SF Symbols on iOS for optimal performance and platform integration, while falling back to Material Icons on Android and web. This ensures your app looks native on each platform while maintaining a consistent design language.
Import
Props
The icon name. Must be a mapped SF Symbol name. Available names:
'house.fill'- Home icon'paperplane.fill'- Send/navigation icon'chevron.left.forwardslash.chevron.right'- Code icon'chevron.right'- Right chevron
The size of the icon in pixels.
The color of the icon. Can be any valid color string (hex, rgb, named color) or OpaqueColorValue.
Additional styles to apply to the icon.
Symbol weight for iOS SF Symbols (ignored on Android/web).
Usage
In Tab Navigator
Fromsrc/app/(tabs)/_layout.tsx:
In Screen Header
Fromsrc/app/(tabs)/explore.tsx:
With Custom Styling
Platform Behavior
iOS
On iOS, the component uses Expo’sSymbolView which renders native SF Symbols. This provides:
- Native rendering performance
- Consistent appearance with iOS system apps
- Support for SF Symbols-specific features (weights, scales)
- Automatic support for new SF Symbols in iOS updates
Android and Web
On Android and web, the component uses@expo/vector-icons/MaterialIcons. Icon names are mapped from SF Symbol names to their Material Design equivalents:
| SF Symbol | Material Icon |
|---|---|
house.fill | home |
paperplane.fill | send |
chevron.left.forwardslash.chevron.right | code |
chevron.right | chevron-right |
Adding New Icons
To add new icons, update theMAPPING object in src/components/ui/icon-symbol.tsx:
- SF Symbols: Use the SF Symbols app (macOS only)
- Material Icons: Browse the Icons Directory
Implementation Details
Android/Web Fallback
The component insrc/components/ui/icon-symbol.tsx provides the fallback implementation:
iOS Native Implementation
The iOS-specific implementation insrc/components/ui/icon-symbol.ios.tsx uses native SF Symbols:
Best Practices
Use Semantic Names
Choose icon names that reflect their purpose (e.g.,
house.fill for home) rather than their visual appearance.Maintain Mapping Consistency
Ensure Material Icon mappings are semantically equivalent to their SF Symbol counterparts for a consistent experience.
Test on All Platforms
Always verify that icon mappings look appropriate on both iOS and Android/web platforms.
Related
- SF Symbols - Apple’s SF Symbols browser
- Material Icons - Material Design icon directory
- expo-symbols - Expo Symbols API
- Navigation Guide - Using icons in tab navigation