Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unrecognized font family Material Icons? #965

Closed
bhoomesh950 opened this issue Mar 14, 2019 · 36 comments
Closed

Unrecognized font family Material Icons? #965

bhoomesh950 opened this issue Mar 14, 2019 · 36 comments

Comments

@bhoomesh950
Copy link

bhoomesh950 commented Mar 14, 2019

I am new to React-Native, I have added react-native-vector-icons library manually to Xcode and Android studio. if run the code with Xcode its executing successfully without any issue. but if i trying to run the code from Terminal (react-native run-ios) its showing 'Unrecognized font family Material' in simulator. but the same this working if i runs the command (react-native run-android).

Please help me

Simulator Screen Shot - iPhone X - 2019-03-14 at 15 31 50

Screenshot 2019-03-14 at 3 35 52 PM

@oblador
Copy link
Owner

oblador commented Mar 18, 2019

Hi, your build is failing and launching a previously compiled (out of date) binary. It seems that you've drag-and-dropped files to your project that has since been deleted from this project instead of importing the project itself. Try to link this library again using the instructions in the readme.

@pachun
Copy link

pachun commented Apr 22, 2019

@bhoomesh950 Make sure the font is linked and also make sure you're importing

import MaterialCommunityIcons from "react-native-vector-icons/MaterialCommunityIcons"

Rather than

import MaterialCommunityIcons from "react-native-vector-icons/MaterialIcons"

Which my editor's (vim) autocomplete (coc) suggested.

(It actually suggested both, but I got the same error as you before getting linking setup (rerun react-native run-ios).

I hope I helped. If not, good luck!

@SnehalAgrawal
Copy link

After installation you need to link the library (After the updation of React Native 0.60, they have introduced autolinking feature means we do not require to link the library but they have also mentioned that some libraries need linking and react-native-vector-icons is one of those cases).
After the linking just install the ios/pod file using pod install

You can follow Example to Use Vector Icons in React Native for the updated example of React Native 0.60

@adjoaEdwin
Copy link

adjoaEdwin commented Oct 16, 2019

After installation and linking the library, you need to check

Run script only when installing under [CP] Copy Pods Resources in Xcode under yourprojectname.

Screenshot 2019-10-16 at 11 41 27 PM

@ghost
Copy link

ghost commented Oct 29, 2019

I had the same issue with Xcode: 11.1, react-native: 61.2 and react-native-sectioned-multi-select which depends on react-native-vector-icons

These steps solved the issue on my machine.

yarn add react-native-vector-icons install icons
yarn react-native link manual linking despite autolink is enabled
cd ios, pod install install fonts for ios
open <ios-project>.xcodeproj checkmark Run script only when installing just like @adjoaEdwin described it
cd ..
watchman watch-del-all, rm -rf node_modules, yarn install, rm -rf /tmp/metro-* clean-up
yarn ios run and confirm it's working

Note: I have no global installation of react-native and yarn doesn't require having "react-native": "react-native" in package.json. that's why yarn react-native link just works. <3 yarn

@BatDroid
Copy link

for me was the face that the fonts were not defined in the info.plist

@Seishin
Copy link

Seishin commented Oct 30, 2019

Encountered this issue today and spent an hour debugging it. My issue was resolved by checking the info.plist file and adding the fonts to the UIAppFonts array as they were missing in it:

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

@lehmamic
Copy link

AntDesign.ttf Entypo.ttf EvilIcons.ttf Feather.ttf FontAwesome.ttf FontAwesome5_Brands.ttf FontAwesome5_Regular.ttf FontAwesome5_Solid.ttf Foundation.ttf Ionicons.ttf MaterialIcons.ttf MaterialCommunityIcons.ttf SimpleLineIcons.ttf Octicons.ttf Zocial.ttf

Thanks, this helped me.

@janhesters
Copy link

janhesters commented Nov 5, 2019

@Seishin When I apply your fix, I can't start my app (try it with a fresh start aka. close simulator and terminal). I get the error described here:

https://react-native-elements.github.io/react-native-elements/docs/getting_started.html#step-2-install-react-native-vector-icons

And if I unlink the assets, the icons aren't found again.

@AlexandreBonfim
Copy link

@Seishin I really appreciate your help.... worked smooth !!!!!

@manoelneto
Copy link

@Seishin really helped me. Thanks!!!!

@Jonathansoufer
Copy link

Thanks @fibric, your step-by-step worked perfectly!

@YeshanJay
Copy link

Thank you @Seishin 😃

fikrikarim added a commit to fikrikarim/gitfeed that referenced this issue Jan 26, 2020
- Change to legacy build on Xcode
- Copy AppDelegate.h and AppDelegate.m from native react-native project to remove unimodule
- Add font to info.plist oblador/react-native-vector-icons#965 (comment)
@naderghanbari
Copy link

naderghanbari commented Jan 28, 2020

This should be in the docs (adding fonts to Info.plist) for people that rely on autolinking.

@moazkh60
Copy link

moazkh60 commented Feb 7, 2020

In RN 0.60 no need for manual setup or even using the link command (using it would cause duplication errors and would make the errors even worse). The solution by @Seishin works perfectly in case of RN 0.60 and above. For some reason my array was empty in plist replacing it with @Seishin 's array worked.

@nakulthebuilder
Copy link

@janhesters I had the same issue as you and I wanted to confirm that once I unlinked and applied the solution suggested by @Seishin it all worked fine.

@ChiwanAhn
Copy link

ChiwanAhn commented Feb 10, 2020

If anyone has an issue even follow @Seishin 's solution,
please try react-native link or yarn react-native link

then, you can see those lines in the console.

info Linking assets to ios project warn Group 'Resources' does not exist in your Xcode project. We have created it automatically for you. info Linking assets to android project success Assets have been successfully linked to your project

@davisbento
Copy link

If anyone has an issue even follow @Seishin 's solution,
please try react-native link or yarn react-native link

then, you can see those lines in the console.

info Linking assets to ios project warn Group 'Resources' does not exist in your Xcode project. We have created it automatically for you. info Linking assets to android project success Assets have been successfully linked to your project

Worked fine for. I was getting error even following all others solutions.

But why need link in react-native > 0.60?

@stanimirsp5
Copy link

My problem was that I didn't had folder 'Fonts' in xcodeproj, read here for more info.

@jedsada-jed
Copy link

Encountered this issue today and spent an hour debugging it. My issue was resolved by checking the info.plist file and adding the fonts to the UIAppFonts array as they were missing in it:

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

And then restart by run react-native start --reset-cache and reinstall.
It's work for me, Thank you @Seishin

@xlcrr
Copy link

xlcrr commented Apr 25, 2020

After you add the file to info.plist and run pod install in the ios folder, open Xcode and add the file at Build Phases -> Copy Bundle Resources -> + New File -> MaterialIcons.ttf

@aqeebimtiaz
Copy link

After installation and linking the library, you need to check

Run script only when installing under [CP] Copy Pods Resources in Xcode under yourprojectname.

Screenshot 2019-10-16 at 11 41 27 PM

It worked perfectly!!!! Thank you so much! (Running Xcode 10.1 on High Sierra - 20 June 2020)

@TommyLeong
Copy link

Unbelievable troublesome to use this lib. Tried the all suggestions above, none work for me. End up I have to drag and drop the .tff file manually from node_module to xcode. Check the steps here

@ShivamJoker
Copy link

Encountered this issue today and spent an hour debugging it. My issue was resolved by checking the info.plist file and adding the fonts to the UIAppFonts array as they were missing in it:

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

this worked why this library hasnt fixed the auto linking we waste so much time doing this

@weblancaster
Copy link

weblancaster commented Aug 1, 2020

@TommyLeong @ShivamJoker I agree its a pain to keep having this issue, I find myself here quite a bit too. BUT we can't forget that open source maintainers are doing this for free and it's our choice to use or not.

@mhalesto
Copy link

npx react-native link solved it for me RN 0.63.2

@aleluis777
Copy link

UIAppFonts

AntDesign.ttf
Entypo.ttf
EvilIcons.ttf
Feather.ttf
FontAwesome.ttf
FontAwesome5_Brands.ttf
FontAwesome5_Regular.ttf
FontAwesome5_Solid.ttf
Foundation.ttf
Ionicons.ttf
MaterialIcons.ttf
MaterialCommunityIcons.ttf
SimpleLineIcons.ttf
Octicons.ttf
Zocial.ttf

Perfect!!!

@paulo101977
Copy link

Encountered this issue today and spent an hour debugging it. My issue was resolved by checking the info.plist file and adding the fonts to the UIAppFonts array as they were missing in it:

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

This works perfectly! Thanks!!!!!!

suman-vanan added a commit to suman-vanan/ssb-frontend that referenced this issue Dec 19, 2020
suman-vanan added a commit to suman-vanan/stonks that referenced this issue Mar 23, 2021
- This commit might porentially cause build errors in future
- Issue: oblador/react-native-vector-icons#965
- Had to do manual linking despite autolinking in newer versions of RN
(autolinking does not work with react-native-vector-icons)
- Checkmarked `Run script only when installing` just like
@adjoaEdwin described in issue linked above
@nphausg
Copy link

nphausg commented Mar 29, 2021

Encountered this issue today and spent an hour debugging it. My issue was resolved by checking the info.plist file and adding the fonts to the UIAppFonts array as they were missing in it:

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

Thanks for saving my time 👏👏👏👏👏👏👏👏👏

@gsmartins96
Copy link

I just need to do the following:

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

And in the component I use MaterialIcons:

Icon.loadFont();

@EnginYilmaz
Copy link

EnginYilmaz commented Apr 30, 2021

@gsmartins96 thank you for pointing this out. After importing, I added Icon.loadFont(); in componentDidMount. Is adding it to componentDidMount proper use?

@RkWoo
Copy link

RkWoo commented Jun 19, 2021

I ran into the problem, and it's ridiculous that I still have to use the same workarounds from two years ago. All this time and the core problem still hasn't been resolved. Thank you @adjoaEdwin and @Seishin, either of your solutions work for me.

@Selenestica
Copy link

Selenestica commented Jun 30, 2021

I'm using VS Code instead of XCode, and I wasn't able to follow along with some of the answers above. I found this StackOverflow answer that did help me, however.
https://stackoverflow.com/a/48601234/13021328

Basically, put the following in your command line:
react-native link react-native-vector-icons
And if still doesn't work, simply rebuild the app:
react-native run-ios

I'm guessing my app just needed to be restarted for the changes to take effect. Hope this helps someone.

@hwolf0610
Copy link

Thanks @Seishin .
When I add below code into info.plist, this was work for me.

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

@SpQuyt
Copy link

SpQuyt commented Jan 9, 2023

I want to make some additions. If you guys add those line in Info.plist and still not working, try add those line AT THE TOP of Info.plist.
Then cd ios => pod install
And clean build
Then rebuild xcode app again.
image

@Sudarshan101
Copy link

follow the below link for solution
https://www.devhubspot.net/post/detail/react-native-unrecognised-font-family-error-solution

@johnf johnf closed this as completed Aug 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests