react-native-vector-icons icon indicating copy to clipboard operation
react-native-vector-icons copied to clipboard

Unrecognized font family only with react-native run-ios

Open NaumanMoazzam opened this issue 6 years ago • 52 comments

MacOS Mojave, react-native run-ios

"unrecognised font family 'font awesome'"

image

This issue was created before #135 . But closed. I tried every solution from there. But didn't work. Help! Cheers!

NaumanMoazzam avatar Feb 07 '19 10:02 NaumanMoazzam

Having the same issue. Tried clearing cache, deleted node_modules, rnpm etc etc. Still having same issue!

Any solution please?

mtahir08 avatar Feb 07 '19 10:02 mtahir08

Add in App.js

import Icon from 'react-native-vector-icons/MaterialIcons'

Icon.loadFont();

In your case you have to import the font awesome

invyctus92 avatar Feb 10 '19 13:02 invyctus92

@invyctus92 Didn't worked for me.

NaumanMoazzam avatar Feb 11 '19 17:02 NaumanMoazzam

@NaumanMoazzam Any solution? Having the same issue

colin-kudos avatar Feb 26 '19 00:02 colin-kudos

@colin-kudos Naa! Still stuck at it. But tried to run from XCode, it works. Not with react-native run-ios.

NaumanMoazzam avatar Feb 26 '19 07:02 NaumanMoazzam

@invyctus92 - Thx, the Icon.loadFont() solution worked for me.

kgomara avatar Mar 05 '19 23:03 kgomara

Add in App.js

import Icon from 'react-native-vector-icons/MaterialIcons'

Icon.loadFont();

In your case you have to import the font awesome

-Thx, the Icon.loadFont() solution worked for me.

liberalisman avatar Mar 07 '19 08:03 liberalisman

So is this Icon.loadFont(); a new requirement ?

JosephDunivan avatar Mar 09 '19 09:03 JosephDunivan

No, only if you're using use_frameworks! in CocoaPods.

oblador avatar Mar 10 '19 21:03 oblador

I have the same issue when I want to use my custom fonts on Mojave OS. I have a custom font named "helvetica-neune-medium.ttf" in my asset folder. I linked the fonts using react-native link But still encountered this error.

Unrecognised font family "helvetica-neue-medium"

"react": "16.8.3",
"react-native": "0.59.5",

mo0rti avatar Apr 27 '19 13:04 mo0rti

Just used Icon.loadFont() and it worked for me. I was not using CocoaPods

MR-Neto avatar May 02 '19 12:05 MR-Neto

If linking fails you might want to run this:

rn-fetch-blob will not automatically add Android permissions after 0.9.4 please run the following command if you want to add default permissions :

RNFB_ANDROID_PERMISSIONS=true react-native link

miodrage avatar May 16 '19 12:05 miodrage

this worked for me I have added font from node_modules/react-native-vector-icon/Fonts instead of added complete folder

Screen Shot 2019-06-11 at 9 23 08 AM

Mohammad-Khalid23 avatar Jun 11 '19 12:06 Mohammad-Khalid23

I had to

  1. react-native link react-native-vector-icons
  2. add node_modules/react-native-vector-icon/Fonts to Copy Bundle Resources
  3. delete other .ttfs from Copy Bundle Resources

which seemed to work for me

kdnguye3 avatar Aug 21 '19 14:08 kdnguye3

Option: With CocoaPods Add the following to your Podfile and run pod update:

pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons' Edit Info.plist as described above.

If you are using use_frameworks! in your Podfile you instead need to dynamically load the icon font by doing Icon.loadFont() when boostrapping your application.

nolan12345 avatar Aug 26 '19 08:08 nolan12345

I do not have use_frameworks! in my Podfile but use_native_modules!. It seems you have to use Icon.loadFont() as well in that case.

mvarendorff avatar Sep 11 '19 06:09 mvarendorff

This issue also exists if you xcode 11 + react-native 0.60.5 and to solve this Icon.loadFont() is working. But if you are using older version of xcode 10.3 + react-native 0.60.5 this error dose not occurs.

rishikeshgaikar avatar Sep 24 '19 13:09 rishikeshgaikar

xcode 11 + "react-native": "0.61.1", no need to add Icon.loadFont().

deftsp avatar Oct 07 '19 06:10 deftsp

Hello! I had the same issue. The solution that I found (And worked for me) in this site : https://github.com/oblador/react-native-vector-icons#ios

The solution works better if you has installed react-native with Cocoapods. I did the following steps (for RN > 0.60):

0 - yarn add react-native-elements react-native-vector-icons 0.1 - Stop emulator and terminal :)

1- Edit Podfile file (dir: ios/podfile ) and add the this line (this need to be in the target app section)

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

If you have in this file this line 'use_frameworks!' you could comment it. If not, you need to do an additional step 2 - run cd ios/ && pod update (this made the link with RN). 3 - Find 'info.plist' file (dir: ios/app/info.plist) and add the following: <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> It's important that the text has to be between <dict></dict> 4 - Finally, Run the app again.

amazing79 avatar Oct 27 '19 20:10 amazing79

Add in App.js

import Icon from 'react-native-vector-icons/MaterialIcons'

Icon.loadFont();

In your case you have to import the font awesome

Thanks @invyctus92, this worked for me

moQuez avatar Oct 29 '19 22:10 moQuez

@MortiTotti, I was having the same problem only that with the font (Rockout-vVaM.ttf=>file; Rockout =>font name in font book), I managed to solve by checking the font name in the Font Book, Ios, on android's devices we refer to the font by the file name, already in iOs should be referenced the name of the font and then returned to work.

Andersonfrfilho avatar Nov 01 '19 16:11 Andersonfrfilho

Add in App.js

import Icon from 'react-native-vector-icons/MaterialIcons'

Icon.loadFont();

In your case you have to import the font awesome

Its worked for Me , Thanks

ravics09 avatar Dec 03 '19 13:12 ravics09

Add in App.js

import Icon from 'react-native-vector-icons/MaterialIcons'

Icon.loadFont();

In your case you have to import the font awesome

Thank you, that works. I think that the documentation need an update.

RodolfoGS avatar Dec 05 '19 22:12 RodolfoGS

Add in App.js

import Icon from 'react-native-vector-icons/MaterialIcons'

Icon.loadFont();

In your case you have to import the font awesome

works fine, thanks.

v3rlly avatar Mar 31 '20 03:03 v3rlly

Add in App.js

import Icon from 'react-native-vector-icons/MaterialIcons'

Icon.loadFont();

In your case you have to import the font awesome

Thank you, it worked for me

OzgunOzdemir avatar Apr 06 '20 13:04 OzgunOzdemir

Screenshot 2020-04-17 at 5 15 21 AM Screenshot 2020-04-17 at 5 15 34 AM

import Icon from 'react-native-vector-icons/MaterialIcons' Icon.loadFont();

I tried all these steps, but nothing works for me.

Versions i'm using

Screenshot 2020-04-17 at 5 28 43 AM

AshikRoyce avatar Apr 16 '20 23:04 AshikRoyce

Screenshot 2020-04-17 at 5 15 21 AM Screenshot 2020-04-17 at 5 15 34 AM

import Icon from 'react-native-vector-icons/MaterialIcons' Icon.loadFont();

I tried all these steps, but nothing works for me.

Versions i'm using

Screenshot 2020-04-17 at 5 28 43 AM

Version 0.62.2 is not stable yet to have custom fonts with it. So make sure to downgrade your project first to "react": "16.9.0", "react-native": "0.61.5",

And then to add fonts again same way as you are doing.it will work

abdulbasit1248 avatar Apr 23 '20 08:04 abdulbasit1248

Editing Info.plist file in ios directory and adding Ionicons.ttf item as it's described here: https://github.com/oblador/react-native-vector-icons#option-manually resolved the issue for me.

dimameshcharakou avatar May 16 '20 09:05 dimameshcharakou

Hello! I had the same issue. The solution that I found (And worked for me) in this site : https://github.com/oblador/react-native-vector-icons#ios

The solution works better if you has installed react-native with Cocoapods. I did the following steps (for RN > 0.60):

0 - yarn add react-native-elements react-native-vector-icons 0.1 - Stop emulator and terminal :)

1- Edit Podfile file (dir: ios/podfile ) and add the this line (this need to be in the target app section)

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

If you have in this file this line 'use_frameworks!' you could comment it. If not, you need to do an additional step 2 - run cd ios/ && pod update (this made the link with RN). 3 - Find 'info.plist' file (dir: ios/app/info.plist) and add the following: <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> It's important that the text has to be between <dict></dict> 4 - Finally, Run the app again.

This worked for RN 0.62.2

azhararmar avatar Jun 13 '20 06:06 azhararmar

2020 and we're still having this issue... neat

dakkafex avatar Jul 04 '20 20:07 dakkafex