Unrecognized font family ionicons

大兔子大兔子 提交于 2019-12-22 04:07:45

问题


I followed the setup instructions in the NativeBase Docs and ran rnpm link. I am getting this error: Unrecognized font family ionicons

also checked by Xcode, the fonts are already in the build phase. What am I missing?


回答1:


Expanding on the exisiting answer and using the solution found on this github issue, do the following;

  1. Close the running packager
  2. Run react-native link react-native-vector-icons
  3. Then run react-native start --reset-cache
  4. Finally run react-native run-ios to restart the simulator



回答2:


For RN 0.60+ don't use react-native link ...! (see Autolinking)

Instead add this in your Podfile:

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

and run pod update (or pod install).

Furthermore add this in your 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>

(took from https://github.com/oblador/react-native-vector-icons#option-with-cocoapods)

Works fine in my project with:

"react": "16.9.0",
"react-native": "0.61.1",
"native-base": "2.13.8" (react-native-vector-icons@6.6.0),



回答3:


This happens if you start your packager and then link packages through rnpm link.

This requires you to restart your packager and try again.




回答4:


I had same issue on my mac.solution :

  • Close the terminal window and simulator.

  • On the same folder which your project is situated write following.. React-native link react-native-vector-icons

  • then start the project by., React-native run-ios




回答5:


If your iOS project is using CocoaPods (contains Podfile) and linked library has podspec file, then react-native link will link the library using Podfile.

Add the comment below to the bottom of your podfile.

# Add new pods below this line

Then run "react-native link [package_name]"

This works for me.



来源:https://stackoverflow.com/questions/38713240/unrecognized-font-family-ionicons

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!