NativeBase: Unrecognized font family 'Ionicons'

Here I have a simple component:

import React, { Component } from 'react';
import {
  Container,
  Header,
  Title,
  Content,
  Button,
  Icon,
} from 'native-base';

export default class App extends Component {
  render() {
    return(
      <Container>
        <Header>
          <Button transparent>
              <Icon name="ios-arrow-back" />
          </Button>

          <Title>Header</Title>

          <Button transparent>
              <Icon name="ios-menu" />
          </Button>
        </Header>

        <Content>

        </Content>
      </Container>
    );
  }
}

I ran rnpm link like I was told to do in the Getting Started section of the docs. I am getting this error: screen shot 2016-07-21 at 11 43 59 am

Any suggestions? Should I try to link native-base manually following the instructions in the docs?

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 50 (3 by maintainers)

Commits related to this issue

Most upvoted comments

Hi All, I was having same problem and resolved by doing this.

  1. close running packager
  2. run react-native link react-native-vector-icons
  3. and run react-native start --reset-cache
  4. Finally use react-native run-ios

Try running rm -rf node_modules && npm install If RN < 0.29, run rnpm link react-native-vector-icons If RN >= 0.29, run react-native link react-native-vector-icons

Try rnpm link react-native-vector-icons

For RN 0.60+ don’t use react-native link ...! (see Autolinking)

Instead add this in your Podfile:

pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'

and run pod update (or pod install).

Furthermore add this in your Info.plist:

<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>
</array>

(took from https://github.com/oblador/react-native-vector-icons#option-with-cocoapods)

Works fine in my project with:

"react": "16.9.0",
"react-native": "0.61.1",
"native-base": "2.13.8" (react-native-vector-icons@6.6.0),

You have restart packager after adding fonts. Close the packager terminal and restart from xcode. Should fix your problem.

react-native link react-native-vector-icons solved my problem.

What worked for me was uninstalling the @expo/vector-icons package recommended by Native-base Getting Started guide, and installing the react-native-vector-icons as a dependency.

npm install react-native-vector-icons --save
react-native link react-native-vector-icons

I solved and I think this is one of cause. http://image.prntscr.com/image/837ddc4fea2d427e8466671c2515b3b1.png I tried to re-run this command react-native link react-native-vector-icons because my RN >= 0.29.

Same problem here even after following the above suggestions.

Update:

I was able to resolve the issue by editing the info.plist, adding the font files, then running the application with Xcode. Docs here: https://github.com/oblador/react-native-vector-icons

I had the same issue.

Solved by running first Link

react-native link

Then restart,

react-native run-ios

@AbhayVarshney If you are using expo/CRNA then you need to import then Ionicons . somewhat like

  async componentWillMount() {
      await Expo.Font.loadAsync({
        'Roboto': require('native-base/Fonts/Roboto.ttf'),
        'Roboto_medium': require('native-base/Fonts/Roboto_medium.ttf'),
        'Ionicons': require('native-base/Fonts/Ionicons.ttf'),
      });
  }

you can have a look here this will work for you .

Simply add the missing font to your ios/project_name/Info.plist file.

Don’t worry about using react-native link this is automatically taken care of in newer versions (from 0.60) and messing around with linking can create annoying bugs.

I only use Material Community Icons so I can ignore the other icon fonts.

<key>UIAppFonts</key>
<array>
  <string>MaterialCommunityIcons.ttf</string>
</array>

One thing to be aware of is react-native unlink react-native-vector-icons clears the UIAppFonts array so unlink first, then edit Info.plist.

<projectDir>/node_modules/native-base/node_modules/react-native-vector-icons/RNVectorIconsManager/RNVectorIconsManager.h:9:9: ‘RCTBridgeModule.h’ file not found

Most important think is if you face with this error if react-native version > 0.6;

  1. ***** MOST IMPORTANT IS THIS : Don’t use reack-native link and unlink your dependecy if you link before react-native unlink react-native-vector-icons

  2. you have to link manually. So update under ios folder to your Podfile with your dependency and add below code to podfile

pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'

  1. than update inside of yourinfo.plist file inside ios folder. Add those fonts under <key>UIAppFonts</key>
                 <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>Fontisto.ttf</string>
		<string>Foundation.ttf</string>
		<string>Ionicons.ttf</string>
		<string>MaterialCommunityIcons.ttf</string>
		<string>MaterialIcons.ttf</string>
		<string>Octicons.ttf</string>
		<string>SimpleLineIcons.ttf</string>
		<string>Zocial.ttf</string>

  1. dont forget to run pod update inside ios directory on terminal
  2. run your app by npx react-native run-ios --simulator="iPhone 8"

These commands resolved my issue:

react-native link react-native-vector-icons
react-native start --reset-cache
react-native run-ios

I have tried everything here, and nothing works.

Unrecognized font family 'FontAwesome'

+[RCTFont updateFont:withFamily:size:weight:style:variant:scaleMultiplier:]
    RCTFont.mm:325
-[RCTTextAttributes effectiveFont]
-[RCTTextAttributes effectiveTextAttributes]
-[RCTBaseTextShadowView attributedTextWithBaseTextAttributes:]
-[RCTTextShadowView attributedTextWithMeasuredAttachmentsThatFitSize:]
-[RCTTextShadowView textStorageAndLayoutManagerThatFitsSize:exclusiveOwnership:]
RCTTextShadowViewMeasure
YGNodeWithMeasureFuncSetMeasuredDimensions(YGNode*, float, float, YGMeasureMode, YGMeasureMode, float, float)
YGNodelayoutImpl(YGNode*, float, float, YGDirection, YGMeasureMode, YGMeasureMode, float, float, bool, YGConfig*)
YGLayoutNodeInternal(YGNode*, float, float, YGDirection, YGMeasureMode, YGMeasureMode, float, float, bool, char const*, YGConfig*)
YGNodeComputeFlexBasisForChild(YGNode*, YGNode*, float, YGMeasureMode, float, float, float, YGMeasureMode, YGDirection, YGConfig*)
YGNodeComputeFlexBasisForChildren(YGNode*, float, float, YGMeasureMode, YGMeasureMode, YGDirection, YGFlexDirection, YGConfig*, bool, float&)
YGNodelayoutImpl(YGNode*, float, float, YGDirection, YGMeasureMode, YGMeasureMode, float, float, bool, YGConfig*)
YGLayoutNodeInternal(YGNode*, float, float, YGDirection, YGMeasureMode, YGMeasureMode, float, float, bool, char const*, YGConfig*)
YGNodeComputeFlexBasisForChild(YGNode*, YGNode*, float, YGMeasureMode, float, float, float, YGMeasureMode, YGDirection, YGConfig*)
YGNodeComputeFlexBasisForChildren(YGNode*, float, float, YGMeasureMode, YGMeasureMode, YGDirection, YGFlexDirection, YGConfig*, bool, float&)
YGNodelayoutImpl(YGNode*, float, float, YGDirection, YGMeasureMode, YGMeasureMode, float, float, bool, YGConfig*)
YGLayoutNodeInternal(YGNode*, float, float, YGDirection, YGMeasureMode, YGMeasureMode, float, float, bool, char const*, YGConfig*)
YGNodelayoutImpl(YGNode*, float, float, YGDirection, YGMeasureMode, YGMeasureMode, float, float, bool, YGConfig*)
YGLayoutNodeInternal(YGNode*, float, float, YGDirection, YGMeasureMode, YGMeasureMode, float, float, bool, char const*, YGConfig*)
YGDistributeFreeSpaceSecondPass(YGCollectFlexItemsRowValues&, YGNode*, YGFlexDirection, YGFlexDirection, float, float, float, float, float, bool, YGMeasureMode, bool, YGConfig*)
YGResolveFlexibleLength(YGNode*, YGCollectFlexItemsRowValues&, YGFlexDirection, YGFlexDirection, float, float, float, float, float, bool, YGMeasureMode, bool, YGConfig*)
YGNodelayoutImpl(YGNode*, float, float, YGDirection, YGMeasureMode, YGMeasureMode, float, float, bool, YGConfig*)
YGLayoutNodeInternal(YGNode*, float, float, YGDirection, YGMeasureMode, YGMeasureMode, float, float, bool, char const*, YGConfig*)
YGNodelayoutImpl(YGNode*, float, float, YGDirection, YGMeasureMode, YGMeasureMode, float, float, bool, YGConfig*)
YGLayoutNodeInternal(YGNode*, float, float, YGDirection, YGMeasureMode, YGMeasureMode, float, float, bool, char const*, YGConfig*)
YGNodelayoutImpl(YGNode*, float, float, YGDirection, YGMeasureMode, YGMeasureMode, float, float, bool, YGConfig*)
YGLayoutNodeInternal(YGNode*, float, float, YGDirection, YGMeasureMode, YGMeasureMode, float, float, bool, char const*, YGConfig*)
YGNodelayoutImpl(YGNode*, float, float, YGDirection, YGMeasureMode, YGMeasureMode, float, float, bool, YGConfig*)
YGLayoutNodeInternal(YGNode*, float, float, YGDirection, YGMeasureMode, YGMeasureMode, float, float, bool, char const*, YGConfig*)
YGNodelayoutImpl(YGNode*, float, float, YGDirection, YGMeasureMode, YGMeasureMode, float, float, bool, YGConfig*)
YGLayoutNodeInternal(YGNode*, float, float, YGDirection, YGMeasureMode, YGMeasureMode, float, float, bool, char const*, YGConfig*)
YGNodelayoutImpl(YGNode*, float, float, YGDirection, YGMeasureMode, YGMeasureMode, float, float, bool, YGConfig*)
YGLayoutNodeInternal(YGNode*, float, float, YGDirection, YGMeasureMode, YGMeasureMode, float, float, bool, char const*, YGConfig*)
YGNodelayoutImpl(YGNode*, float, float, YGDirection, YGMeasureMode, YGMeasureMode, float, float, bool, YGConfig*)
YGLayoutNodeInternal(YGNode*, float, float, YGDirection, YGMeasureMode, YGMeasureMode, float, float, bool, char const*, YGConfig*)
YGNodeAbsoluteLayoutChild(YGNode*, YGNode*, float, YGMeasureMode, float, YGDirection, YGConfig*)
YGNodelayoutImpl(YGNode*, float, float, YGDirection, YGMeasureMode, YGMeasureMode, float, float, bool, YGConfig*)
YGLayoutNodeInternal(YGNode*, float, float, YGDirection, YGMeasureMode, YGMeasureMode, float, float, bool, char const*, YGConfig*)
YGNodelayoutImpl(YGNode*, float, float, YGDirection, YGMeasureMode, YGMeasureMode, float, float, bool, YGConfig*)
YGLayoutNodeInternal(YGNode*, float, float, YGDirection, YGMeasureMode, YGMeasureMode, float, float, bool, char const*, YGConfig*)
YGNodelayoutImpl(YGNode*, float, float, YGDirection, YGMeasureMode, YGMeasureMode, float, float, bool, YGConfig*)
YGLayoutNodeInternal(YGNode*, float, float, YGDirection, YGMeasureMode, YGMeasureMode, float, float, bool, char const*, YGConfig*)
YGNodelayoutImpl(YGNode*, float, float, YGDirection, YGMeasureMode, YGMeasureMode, float, float, bool, YGConfig*)
YGLayoutNodeInternal(YGNode*, float, float, YGDirection, YGMeasureMode, YGMeasureMode, float, float, bool, char const*, YGConfig*)
YGNodelayoutImpl(YGNode*, float, float, YGDirection, YGMeasureMode, YGMeasureMode, float, float, bool, YGConfig*)
YGLayoutNodeInternal(YGNode*, float, float, YGDirection, YGMeasureMode, YGMeasureMode, float, float, bool, char const*, YGConfig*)
YGNodelayoutImpl(YGNode*, float, float, YGDirection, YGMeasureMode, YGMeasureMode, float, float, bool, YGConfig*)
YGLayoutNodeInternal(YGNode*, float, float, YGDirection, YGMeasureMode, YGMeasureMode, float, float, bool, char const*, YGConfig*)
YGNodeCalculateLayout
-[RCTShadowView layoutWithMinimumSize:maximumSize:layoutDirection:layoutContext:]
-[RCTRootShadowView layoutWithAffectedShadowViews:]
-[RCTUIManager uiBlockWithLayoutUpdateForRootView:]
-[RCTUIManager _layoutAndMount]
-[RCTUIManager batchDidComplete]
__32-[RCTCxxBridge batchDidComplete]_block_invoke
_dispatch_call_block_and_release
_dispatch_client_callout
_dispatch_queue_serial_drain
_dispatch_queue_invoke
_dispatch_root_queue_drain
_dispatch_worker_thread3
_pthread_wqthread
start_wqthread

skjermbilde 2018-08-04 kl 18 21 52 skjermbilde 2018-08-04 kl 18 22 08

Also tried to install another libary, that doesn’t work either.

Solved with

react-native link react-native-vector-icons

I faced the issue with both v2.1.4 and v2.1.5 So I fixed the version in package.json to "native-base": "2.1.3" Then ran the following: rm -rf node_modules npm i react-native link

@charlieroth You can try to recreate the iOS Scheme on XCode, and run react-native link or rnpm link after.

Same problems… also checked xcode. The fonts are already in the build phase

try to delete ios/build, and rebuild by react-native run-ios. that solved my problem.

I had the same problem, I fixed buy running run react-native link react-native-vector-icons

Screen shot for adding Ionicons.ttf to Info.plist

xcode version 11.3

"native-base": "^2.13.8", "react": "16.9.0", "react-native": "0.61.5"

Screen Shot 2020-01-17 at 9 02 55 PM

I read through link provided by eddyfrank. (https://github.com/oblador/react-native-vector-icons#option-with-cocoapods) Followed the iOS portion shown below: image

easy solution

run

expo install expo-font

react-native link react-native-vector-icons solved my problem.

I specifically want to use Entypo from react-native-vector-icons. I have copied over the Fonts folder to the Xcode, checked all the icon types are there in info.plist and copy bundle resources, rm -rf node_modules && npm install, clean up last build, react-native link react-native-vector-icons and then npm start but it still does not work.

import Entypo from 'react-native-vector-icons/Entypo';

<Entypo name={icon} size={25}/>

and nothing shows up (Iconwise…) 😦