question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to link react-native-vector-icons

See original GitHub issue

Issue Description

I am following native-base docs https://docs.nativebase.io/Components.html#icon-def-headref but getting error Unrecognized font family ‘Ionicons’ for following code

Issue is of Icon

import React, { Component } from 'react';
import { Container, Header, Content, Icon } from 'native-base';
export default class IconExample extends Component {
  render() {
    return (
      <Container>
        <Header />
        <Content>
          <Icon name='home' />
          <Icon ios='ios-menu' android="md-menu" style={{fontSize: 20, color: 'red'}}/>
          <Icon type="FontAwesome" name="home" />
        </Content>
      </Container>
    );
  }
}

https://cloud.githubusercontent.com/assets/13981427/17029309/c48ee584-4f38-11e6-8e01-0df6f7dabc8f.png

node, npm, react-native, react and native-base version, expo version if used, xcode version

node =>   v12.16.3
npm => 6.14.4
native-base => "^2.13.12"

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
saini-gcommented, Jul 23, 2020

Finally got to the bottom of this, the issue was because of the font families not being available in the iOS project. Even though the libraries are auto-linked in React Native >= 0.60 the fonts are still missing and have to be manually added to the iOS project. Here’s how to do that

  • Go to the info.plist file located in [project_root] > ios > [project_name] > info.plist. It’s an XML type file
  • Add the following code. Make sure to not add it between any existing node
    <key>UIAppFonts</key>
    <array>
      <string>AntDesign.ttf</string>
      <string>Entypo.ttf</string>
      <string>EvilIcons.ttf</string>
      <string>Feather.ttf</string>
      <string>FontAwesome.ttf</string>
      <string>FontAwesome5_Brands.ttf</string>
      <string>FontAwesome5_Regular.ttf</string>
      <string>FontAwesome5_Solid.ttf</string>
      <string>Foundation.ttf</string>
      <string>Ionicons.ttf</string>
      <string>MaterialIcons.ttf</string>
      <string>MaterialCommunityIcons.ttf</string>
      <string>SimpleLineIcons.ttf</string>
      <string>Octicons.ttf</string>
      <string>Zocial.ttf</string>
      <string>Fontisto.ttf</string>
    </array>
    
0reactions
stale[bot]commented, Dec 21, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

React native vector icon not working on current version 0.60
This worked for me on an upgraded project and on a brand new RN 0.60.0. For IOS add this to ios/projectname/Info.plist
Read more >
react-native-vector-icons - npm
Customizable Icons for React Native with support for NavBar/TabBar, image source and full styling.. Latest version: 9.2.0, last published: 6 ...
Read more >
React Native Vector Icons - iOS And Android Setup - YouTube
Title: React Native Vector Icons - iOS And Android SetupCode Big ... try restarting your device. Your browser can't play this video.
Read more >
let's display icons to use react-native-vector-icons library.
To link react-native-vector-icons on iOS, execute ios/[project].xcworkspace to open Xcode. ... After executing Xcode, right-click the project and click New Group ...
Read more >
Troubleshooting - React Native Elements
Although we try to make the experience of using React Native Elements. ... react-native link react-native-vector-icons ... "Unable to resolve module x".
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found