I have a React Native App v .66.1 - And I have my custom fonts loaded and they are working for both iOS and Android. However, I cannot use the fontWeight property to bold them. Is there a step I'm missing?
My font structure:
root/src/assets/fonts/[fonts are here]
react-native.config.js file:
module.exports = {
assets: [
'./src/assets/fonts'
]
}
CodePudding user response:
Font weight does not always work properly on Android. I'd recommend using different files for Regular and Bold variations, like:
- FontName-Regular.ttf
- FontName-Bold.ttf
Don't forget to link them using react-native link
Then use the appropriate fontFamily on your regular or bold text.
CodePudding user response:
Edit your react-native.config.js
file like this:
module.exports = {
project: { //maybe you're forgetting this
ios: {},
android: {},
},
assets: ['./src/assets/fonts']
};
After this, link your assets using the react-native link
cmd.
Hope this works for you.