Unrecognized font family on iOS simulator with React Native

后端 未结 14 1421
北海茫月
北海茫月 2020-12-14 05:55

I\'ve added Linux Biolinum fonts (http://www.dafont.com/linux-biolinum.font, LinBiolinum_R.ttf, LinBiolinum_RB.ttf) to my React Native project. Android version is OK. But on

相关标签:
14条回答
  • 2020-12-14 06:41

    You can also try this, specify your fonts this way, map them into three styles:

    For instance Gilroy-SemiBoldItalic

    // iOS
    {
      fontFamily: 'Gilroy',
      fontWeight: '600',
      fontStyle: 'italic'
    }
    
    // Android
    {
      fontFamily: 'Gilroy-SemiBoldItalic'
    }
    

    You can also create a function to generate styles for a font with given weight and style.

    Hope this helps

    0 讨论(0)
  • 2020-12-14 06:45

    In my case the name of the ttf file was wrong. I had to edit ios/MyApp/Info.plist and change manually the filename of the font.

    From:

    ...
    <array>
      <string>Roboto_medium.ttf</string>
    ...
    

    To:

    ...
    <array>
      <string>Roboto-Medium.ttf</string>
    ...
    
    0 讨论(0)
提交回复
热议问题