custom font is not working in react native

[亡魂溺海] 提交于 2019-12-12 04:38:55

问题


After saving the fonts in my assets folder of my project I linked it by the command react-native link the links were installed and I cross checked the installation in my android>src>main>assets>fonts and everything was fine there too and I expected to get the custom font using the styling fontFamily: 'Coda-Heavy' but I didn't get the required custom font in run

Also please refer to this link I have posted it as an issue in react native:

https://github.com/facebook/react-native/issues/15266


回答1:


Have you do this steps?

1 Create folder /assets/fonts in main root

2 Put this in your package.json

“rnpm”: {
   “assets”: [“./assets/fonts”]
}

3 And then run react-native link again

4 Your font will be copied to android/app/src/main/assets/fonts



来源:https://stackoverflow.com/questions/45407315/custom-font-is-not-working-in-react-native

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