question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Expo `.ttf` fonts don't load using SDK 42 and `expo-font@9.2.1`

See original GitHub issue

Summary

Font loading doesn’t seem to work with .ttf fonts. It used to… but trying to upgrade to the latest Expo SDK results in errors. There is more information in the reproduction repo below, code is identical to the documentation over here.

Managed or bare workflow? If you have ios/ or android/ directories in your project, the answer is bare!

managed

What platform(s) does this occur on?

iOS

SDK Version (managed workflow only)

42

Environment

Mac OS 11.4 Node 14 Latest expo (42)

Reproducible demo or steps to reproduce from a blank project

https://github.com/hanford/expo-font-bug

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:13 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
robinperssoncommented, Oct 8, 2021

Im still having problem making this work. I can´t get any fonts or icons to load for ios

2reactions
EvanBaconcommented, Sep 3, 2021

@dashcraft interesting, if this is happening in dev then it might be a metro.config.js / expo-cli issue – in production it’s probably an expo-updates update. I’m investigating it as a metro issue, and I’ve linked the issue to the updates team for them to check out as well.

Edit: cannot repro using the same specs here https://github.com/expo/expo/issues/13358#issuecomment-912818774 downgrading my expo-cli version to determine if this was fixed somehow.

Edit 2: I can repro the font issue using the font repro, thanks @hanford for providing it! Using yarn instead of npm install appears to fix the issue, gonna try and figure out why. Clearing the package-lock.json, and regenerating seems to also fix the issue. Possibly related to this dependency issue:

Screen Shot 2021-09-03 at 3 50 45 PM

Edit 3: Can confirm the duplicate copy of expo-font is the issue, not exactly sure how we can prevent this right now, both versions appear to be the same version (9.2.1) 🙃 I’d recommend using yarn to install packages as it works better than npm install. Nuking the package-lock.json and reinstalling with npm install also worked, but it’s unclear why it only worked this time and not before since the versions didn’t change.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Font
expo -font allows loading fonts from the web and using them in React Native components. See more detailed usage information in the Fonts...
Read more >
React Native Expo - Custom Fonts Not Loading With Font. ...
Here is a fresh project I set up attempting to get a custom font installed. import React, { useState } from 'react'; import...
Read more >
[Deprecated] Custom fonts in React Native (Expo)
To get started, download the font you want to use in your app in .ttf or .otf format. Create a directory in the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found