react-native-vector-icons unrecognized font family

React Native Vector Icons Unrecognized Font Family

If you are working with React Native and have installed the React Native Vector Icons package, you may encounter an issue where the icon font is not recognized and instead displays as a series of boxes or question marks.

The Problem

This problem occurs because the font files for the icons are not being properly linked to the project. This can happen when the package is installed but not properly configured or when the font files are not included in the project.

The Solution

There are a few steps you can take to fix this issue:

  • Link the font files: The first step is to link the font files to your project. To do this, open your terminal and navigate to your project directory. Then, run the following command:
react-native link react-native-vector-icons

This will automatically link the font files to your project and ensure that they are properly installed.

  • Clear cache: If linking the font files does not fix the issue, try clearing the cache of your project. This can be done by running the following command:
react-native start --reset-cache

This will clear the cache of your project and force it to recompile, which may resolve any issues with the font files.

  • Manually link the font files: If the above steps do not work, you can try manually linking the font files to your project. To do this, follow these steps:
  1. Open the finder on your Mac and navigate to the node_modules/react-native-vector-icons/Fonts folder.
  2. Copy all the files in the Fonts folder and paste them into the ios/{your-project-name}/Fonts folder.
  3. In Xcode, select your project and then your target. Navigate to the Build Phases tab and expand the Copy Bundle Resources section.
  4. Click the + button and add all the font files you just copied into the Fonts folder.
  5. Save your changes and rebuild your project.

These steps should ensure that the font files are properly linked to your project and that the icons are displayed correctly.

Subscribe to The Poor Coder | Algorithm Solutions

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.
[email protected]
Subscribe