Moving away from @expo/vector-icons
Key Points
- Switch to @react-native-vector-icons scoped packages
- Run codemod: npx @react-native-vector-icons/codemod
- Expect smaller bundles and no aliasing
Summary
Expo recommends switching from @expo/vector-icons to the icon-pack-specific @react-native-vector-icons packages. The newer scoped packages integrate with expo-font, work in Expo Go and dev builds, reduce bundle size, and remove the need for aliasing.
Key Points
- Recommendation: replace imports from
@expo/vector-iconswith the corresponding packages under the@react-native-vector-iconsscope. - Benefits:
- Access latest icon sets (e.g., Lucide) and newer features.
- Smaller shipped bundles by avoiding accidentally bundling all icon fonts.
- Simpler project setup with no Babel/Metro aliasing and fewer version drift risks.
- Migration steps:
- Run the automated codemod:
npx @react-native-vector-icons/codemodand inspect changes. - Run
npx expo doctorto ensure@expo/vector-iconsorreact-native-vector-iconsare removed. - Ensure
expo-fontis installed and configured; do NOT add font paths fromnode_modules/@react-native-vector-icons/to the expo-font config (this causes build errors). - Verify any custom icons created with
createIconSetFromIcoMoon/Fontello remain functional.
- Run the automated codemod:
- Potential issues to watch for:
- Icon font conflicts when mixing packages or versions can render icons as
?or empty squares. - A doctor warning will surface mixing of new
@react-native-vector-iconspackages with old packages.
- Icon font conflicts when mixing packages or versions can render icons as
- Compatibility and timeline:
- The new scoped packages work in Expo Go, dev builds, and across platforms.
@expo/vector-iconswill be maintained for a migration period but will be deprecated in a future Expo SDK release.
Actionable checklist for engineers
- Run
npx @react-native-vector-icons/codemodand review diffs. - Confirm
expo-fontis present and remove any incorrect node_modules font paths from font config. - Run
npx expo doctorand fix any mixing warnings. - Test app in Expo Go / dev build and check icon rendering across dependencies.
- Open an issue with Expo if you encounter migration problems.
Bottom line
Migrating is straightforward with the provided codemod and yields cleaner projects, more predictable builds, and often smaller binaries. Plan to migrate before the future deprecation of @expo/vector-icons.