s-leg3ndz
s-leg3ndz

Reputation: 3528

Add custom font family in React Native iOS

I would like add custom font family on my React Native App on iOS. I've no problem with Android, but i've an error in iOS :

Unrecognized font family 'dinproRegular'

I've use this link for setup my font, but no result.

File name : dinproRegular.ttf

Call in react-native : fontFamily: "dinproRegular" // Test with "Dinpro Regular" too

No result :(

Anyone have idea ?

Upvotes: 2

Views: 6459

Answers (2)

Deepa Suryawanshi
Deepa Suryawanshi

Reputation: 91

In iOS, you can see what font name you should use in code to let it work Use below code in AppDelegate.m to get all font names supported in your app.

for (NSString* family in [UIFont familyNames])
  {
    NSLog(@"%@", family);
    for (NSString* name in [UIFont fontNamesForFamilyName: family])
    {
      NSLog(@" %@", name);
    }
  }

Upvotes: 0

Roger Coll
Roger Coll

Reputation: 125

Just check the fonts that are currenly installed in Ios or Android:

https://github.com/react-native-training/react-native-fonts

If you want to add custom fonts:

https://medium.com/@danielskripnik/how-to-add-and-remove-custom-fonts-in-react-native-b2830084b0e4

Hope it helps!

Upvotes: 1

Related Questions