问题
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