Unrecognized Font Family on React Native

前端 未结 5 1293
春和景丽
春和景丽 2021-02-11 01:57

I\'m running into a peculiar error using React Native. Inside my button.js I am doing

import Icon from \"react-native-vector-icons/MaterialIcons\";         


        
5条回答
  •  死守一世寂寞
    2021-02-11 02:17

    npm install --save react-native-vector-icons
    

    add the line below to the ios/podfile file then run pod update

    pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'
    

    in the ios/projectNameFolder/info.plist add codes below between tags. If you already have this UIAppFonts array just edit strings. Be sure you have fonts under node_modules>react-native-vector-icons

    UIAppFonts
    
      AntDesign.ttf
      Entypo.ttf
      EvilIcons.ttf
      Feather.ttf
      FontAwesome.ttf
      FontAwesome5_Brands.ttf
      FontAwesome5_Regular.ttf
      FontAwesome5_Solid.ttf
      Foundation.ttf
      Ionicons.ttf
      MaterialIcons.ttf
      MaterialCommunityIcons.ttf
      SimpleLineIcons.ttf
      Octicons.ttf
      Zocial.ttf
    
    

    clean cache and restart application with rebuild. It suppose to work.

提交回复
热议问题