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 only with react-native run-ios #135
Comments
Cannot reproduce, the examples within this repo run just fine with |
I tried:
Do you mean this or something else? |
it wasn't connected to |
Hello. I am sorry for raising a dead thread, but I have run into this exact problem, however the fix listed here does not apply (at least I don't think it does). Here is my situation. The app has had this package installed and working fine for awhile now with only 1 custom iconFont for our company. Recently we have needed to branch out, so I added the FontAwesome font to the project. I followed all of the steps and everything works great if you run from xcode. I also completely removed the package and reinstalled using rnpm but got the same result. I have tried reseting npm cache, deleting node_modules folders and reinstalling everything, killing tempdir, and deleting xcode project derived data. I am out of options. Any help would be greatly appreciated! |
I'm having the same issue now with RN 0.34.x and 0.35.0, Xcode 8. Basically the font is loaded when run from XCode (debug and release) but not picked up when run with npm and react-native on the command line. Did anyone get this fixed? |
I am having the exact same issue as @ekhall. I upgraded to RN 0.35.0 and running Xcode 8. The fonts will load fine if I run the project through Xcode but get the I tried downgrading back to RN 0.34.0 but that didn't help. |
I got the issue fixed for RN 0.35.0 and Xcode 8. Delete the items in your This will start you off with a clean slate. |
Pretty much the same answer here - something got very messed up with the iOS build shortly after this post. I created a new project, copied in the js source, and it worked fine. |
|
Have the same thing with:
Exact error after splash screen disappears: Have tried:
Only happens when running via CLI |
@simonstewart That's a regular font and is unrelated to this module. |
was having the same issue as mentioned by @ekhall . Even I run the command "react-native link react-native-vector-icons" but it was not working. Then i dont know what happened, I ran the same command again then npm start and reloaded the project, it was running fine. surprising!!! |
You absolutely need to check that you did that: This is the step I was missing. Also check you follow the first 2 steps (Resources and info.plist) from the Troubleshooting section. |
You may need to double-check whether xCode is importing those assets from react-native-vector-icons or another module (eg native-base). If it's a different package then make sure your |
I had the same issue of not able to load the fonts on Mac for IOS... I was getting I pulled up the fonts in app directory and loaded it using package.json
https://hiddentao.com/archives/2017/03/10/get-custom-fonts-working-in-react-native/ @hiddentao's article explains it very well! |
I had this problem and tried most suggested solutions without luck. Turns out that I had previously imported the font from my Downloads folder on my computer, which I had then emptied. To solve this, make sure that your font still exists on your disk (ie the font is not red in Xcode) and the reference under "Build Phases" and then "Copy Bundle Resources" is to the still-existing font file. Lesson learned: Always put a font file in the project folder before importing it into Xcode. |
You should run react-native install react-native-vector-icons & react-native link react-native-vector-icons |
A probable solution: p.s. there's still a lot of warnings regarding prop usage etc. but the errors are resolved and the build runs successfully. |
One thing that might have not been checked is that after you copy all fonts from |
I found out that following the manual instructions were kind of complicated (I'm not used to Xcode at all, react-native is my first project on a mobile). So what I did was: So, what I mean here is that i actually had to go for "run-ios", if I had just "npm start" it wouldn't be enough to work for me, run-ios to kind of "recompile" everything the way you want it to be :) |
If someone else have had this error
|
delete |
I was having the same problem. I linked with react-native link react-native-vector-icons, force quit my simulator, then reran react-native run-ios . It worked! Don't mean to sound like a noob, but try restarting the app! |
Open your font with a text editor and search the real name of your font. In some cases, font name is different from the file name. |
I'm using a custom font (not vector icons) and here's my thoughts Didn't Work
Worked
Hope it helps someone :) |
I got this error when I was trying to use custom icons from icomoon.ttf and I am able to find solution for this. check out this article. |
After cobbling together bits and pieces on loading the icons for react-native-elements I finally figured this out. Check out my blog for a write-up. |
This saved my day |
I had the same problem and it was solved by running react-native link react-native-vector-icons and then building the project once in xcode. |
Hi, I fixed this by opening In addition to this I also made sure the fonts were visible in the XCode project, and under "Copy Bundle Resources" they are listed out. |
This happened to me when I remove the fonts I wasn't using from the "Fonts provided by application" section of the info.plist and the "Copy Bundle Resources" section of the main target. Apparently there are lingering references to those fonts even if you don't use them. You can manually add all those files back, or what is much easier to do is run |
RN 0.6 supposed to do autolinking now, however it doesn't seem to work properly with
worked for me on 0.6 based on this issue's scattered instructions. @oblador could you confirm RN0.6 autolinking? |
Same issue, need to link manually |
+1 |
exclude files inside |
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). You can follow Example to Use Vector Icons in React Native for the updated example of React Native 0.60 |
Every above solutions didn't work. Only command |
Add the following to your
|
On RN0.61.5 and using react-native-vector-icons i copy the .tff files into the node_modules/react-native-vector-icons/fonts/ And run |
If fixes above didn't do the job, you may be using the wrong font family name. By adding this code to your AppDelegate.m you can see a list of fonts loaded - ensure you use the same name as in output.
For me the case was that output from the above was "FontName-Regular", but in a style file it was "FontNameRegular". |
In my case it only threw error when i was trying to use weighted font directly like |
still having this error |
The combination of:
Made the icons appear for me on iOS. I have yet to try for Android. Edit: I also had to mess around with the placement of the script noted in point 1 (Podfile related), so that may be a part of the solution. |
This worked for me too, thanks |
After you do everything but still not working.
|
Thank you very much that solved it for me as well!! |
This is the jackpot. Works like a charm. Thank you so much @brandonmwest |
This worked!. had to run |
For anyone else still struggling, this is what sorted it for me: import EntypoIcon from 'react-native-vector-icons/Entypo';
EntypoIcon.loadFont(); |
you saved my life @dooleyb1 ❤️ |
error Linking "react-native-vector-icons" failed. |
just type 'npx react-native-asset ' after installation setup finish |
Basically, my settings work if I build and run in xcode 7.2
Rather than if I'm use
react-native run-ios
I gotUnrecognized font family
.any idea?
Cheers
The text was updated successfully, but these errors were encountered: