-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
[Font] Expo cannot load a font due to multiple versions of expo-font
installed
#5507
Comments
Hi! Sorry you're running into this dependency mixup What version |
We are using expo-font v6.0.1
|
@Jack3113 can you try deleting node modules/reinstalling, and clearing cache with The |
The problem is still here
|
Okay so after more than 20 restarts with clear cache option, it works. I don't know why. |
Hi, same problem here after upgrading from sdk 33 to 34 |
upgraded from sdk 32 to 33 . Same error as above |
I'm also having this problem |
I'm having this issue as well with Expo SDK 35. |
expo-font
installed
face this issue with custom fonts. In code i wait untill resolves this
after i render my app. And looks like promise resolves before it loaded and i receive same errors like
|
I updated the |
I didn't have this issue upgrading from SDK 33 => 34 (ejected), but I am with the 34 => 35 upgrade I'm performing this morning. I have erased the iOS simulator content & settings multiple times, cleared the build in Xcode, delete the node_modules folder, and started the expo server with the cache clear option multiple times. I have also tried suggestions from all of these issues:
The suggestion above about removing the nested |
I believe I resolved the issue on our project yesterday. We had I updated The reason I came back to visit was that while the app worked well for iOS and Android in the emulators, one we published the iOS app via TestFlight font awesome fonts were showing as question marks. The Android build worked fine. We are distributing as a standalone ejected app. |
I face this issue as well trying to update expo from 33 to 34. I tried many, many things, differents version of expo-font, clearing cache, clearing node_modules, different versions of expo, deleting yarn.lock, nothing works. And I really need to update to SDK 34 because Calendar Events don't work propertly in 33 and my client needs them to work. |
I finally solved it. Turns out the error had nothing to do with expo-fonts, the error displaying was misleading. I used to import assets this way in my App.js file: And importing this way: fixed the errors of loading fonts. |
I'll let myself close this issue tentatively. I think we've identified the underlying problem and some solutions have been proposed in this thread. I hope you don't bump into this issue in the future, but if you do, let us know! 🙂 |
@sjchmiela Any plans to port those "solutions" into expo ? |
This issue popped up again when i upgraded from v35 to v36. Only |
if you are using any of these libraries i found that they make conflict |
@YahiaBadr - those libraries should work fine! i just set them up and they worked as expected. make sure you install react-native-svg with |
@brentvatne i was searching for almost a day for my problem and it ended up with creating a new app using |
@brentvatne - that's really crazy, i installed them again and they worked smoothly. I think the problem that i didn't use expo install the first time i installed them. Any way THANK YOUUU!! |
This issue popped up for me after upgrading to sdk 37. As i do not have a metro.config.js this is no solution. Removing the expo-font in node_modules folder of expo works but surely is no permanent solution. |
@aeife - it's basically an issue with npm not deduping dependencies in a way we can rely on. we added a workaround in latest expo-cli for this, we clear your lockfile and node_modules for you when you run upgrade. discussed more in https://forums.expo.io/t/sdk-37-unrecognized-font-family/35201/11?u=notbrent which i have inlined here for convenience:
|
🐛 Bug Report
Environment
I'm debugging an iOS app.
Steps to Reproduce
Expected Behavior
Expo must draw a glyph with the custom font.
Actual Behavior
Bug explanation
Currently, we need to
import * as Font from "expo-font"
in code and useFont.loadAsync(aCustomFont)
to load the font. So we use a "expo-font" module fromnode_modules
.In expo, the
withExpoRoot.tsx
file import theFont.processFontFamily
function to use custom fonts and draw glyphs of these fonts (see the code here).But the expo module uses another
expo-font
module which is installed in thenode_modules
of the expo module.In other way, expo works with 2 expo-font modules. But the problem is the module which is loading fonts in custom code (with
Font.loadAsync
) is different from the one in expo which is using fonts (withFont.processFontFamily
).Here's a screenshot from the
node_modules
folder in my text editor with the 2 expo-font modules :I hope I've been clear in my explanation. And thanks for developing expo ! :)
The text was updated successfully, but these errors were encountered: