Issue
I'm trying to use a custom font on my app but it doesn't work. I have followed numerous steps from other similar questions but nothing works.
I'm not getting any error.
The path to the assets folder: Assets source
This is what I tried:
- Creating react-native.config.js file on root project with the following code:
module.exports = {
project: {
ios: {},
android: {},
},
assets: ['./src/assets/fonts']
};
- Running react-native link: This didnt give me any errors:
info Linking assets to ios project
info Linking assets to android project
success Assets have been successfully linked to your project
- Naming the font exactly as its named in styles WITHOUT using any fontWeight:
<Text style={[styles.texto_Titulo, {fontFamily: "LatoBlack"}]}>
ENTRADA
</Text>
- Recompiling with npx react-native run-android after react-native link
Why is this not working?
Solution
Okay so this happens to be a current bug for React Native 0.62. The workaround for this problem is copying the assets/fonts folder to /android/app/src/main/ path. This fixed the problem.
Answered By - Aldimir
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.