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

Unrecognized font family when bringing app back from background iOS.

Open thefinnomenon opened this issue 5 years ago • 9 comments

Environment

iOS react-native: 0.61.1 react-native-vector-icons: 6.6.0

Description

I install the library following the documentation.

yarn install react-native-vector-icons
cd ios/
pod install

// rebuild

On launch, the icons work fine but upon minimizing the application and bringing it back, I get the following error.

Simulator Screen Shot - iPhone X - 2019-12-06 at 21 32 30

After dismissing it the icons now display as [?].

thefinnomenon avatar Dec 07 '19 02:12 thefinnomenon

Add to info.plist:

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

Patys avatar Dec 12 '19 15:12 Patys

And for android:

apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"

in android/app/build.gradle

Patys avatar Dec 12 '19 15:12 Patys

@thefinnomenon Have you fixed the issue? i am facing same issue.

kalyanijamunkar10 avatar Dec 24 '19 09:12 kalyanijamunkar10

Nope, I haven't been able to fix it. I am not even sure where to start because the fonts are successfully loading at the start and for some reason are unloaded sometime between the app going to the background and the app resuming.

thefinnomenon avatar Dec 27 '19 03:12 thefinnomenon

Same issue... Been trying to resolve this for a couple days now......

nica0012 avatar Feb 10 '20 16:02 nica0012

@kalyanijamunkar10 @thefinnomenon on windows I have fixed upgrading gradle android -> build.gradle classpath("com.android.tools.build:gradle:3.6.1") and android -> gradle -> wrapper distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip

npx react-native info

info Fetching system and libraries information...
System:
    OS: Windows 10 10.0.18362
    CPU: (6) x64 Intel(R) Core(TM) i5-8500 CPU @ 3.00GHz
    Memory: 3.95 GB / 15.86 GB
  Binaries:
    Node: 12.2.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.16.0 - C:\Users\Julian\AppData\Roaming\npm\yarn.CMD
    npm: 6.9.0 - C:\Program Files\nodejs\npm.CMD
  SDKs:
    Android SDK:
      API Levels: 23, 24, 25, 26, 27, 28, 29
      Build Tools: 23.0.1, 25.0.0, 25.0.1, 25.0.3, 26.0.1, 26.0.2, 26.0.3, 27.0.3, 28.0.3, 29.0.2
      System Images: android-18 | Google APIs Intel x86 Atom, android-19 | Google APIs Intel x86 Atom, android-24 | Google APIs Intel x86 Atom, android-26 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom, android-29 | Google Play Intel x86 Atom, android-R | Google Play Intel x86 Atom
  IDEs:
    Android Studio: Version  3.6.0.0 AI-192.7142.36.36.6200805
  npmPackages:
    react: 16.9.0 => 16.9.0
    react-native: 0.61.5 => 0.61.5

notjulian avatar Mar 04 '20 10:03 notjulian

Not specifically related to this package, I noticed it with other custom fonts too. I'm om 0.64.1. (on iOS to be clear)

Update: turns out this issue was caused because the font was duplicate linked, react-native link linked it in Xcode and it was copied by the Pods copy script.

wouterds avatar May 19 '21 09:05 wouterds

Hi there,

We are also having same issue with custom fonts, it works fine in android and iOS when the app is launched. The issue is when app goes background and come back the fonts are not loaded by iOS platform. Can anyone have any solutions to this issue, please suggest.

Thanks

rampellisrinu avatar Feb 06 '22 15:02 rampellisrinu

I had the same issue, and use the font PostScript name is work for me.

https://stackoverflow.com/questions/69525249/unrecognised-font-family-after-backgrounding-the-app

xothis avatar Aug 04 '22 14:08 xothis

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

Sudarshan101 avatar Mar 13 '23 14:03 Sudarshan101

For those landing here from Google:

The PostScript Name is NOT necessarily the same as the font's "Full Name" metadata property. On a mac, you must install the font in Font Book in order to view the full metadata from it. It's strange because using the "Full Name" seems to work just fine on first launch but font loading seems to fail upon the first UI update you make when re-foregrounding the app.

One would expect the first launch not to resolve the fonts at all, but it does.

kevindice avatar Aug 17 '23 19:08 kevindice