'How to get fontWeight in React native androidI
fontSize: 22,
fontWeight: '500,
fontFamily: "Montserrat-Regular"
Font weight is not working in Android using react-native. As I am using fontWeight from 100-500 it is showing regular font but as I change it to 600-900 giving me bold font. How can I get this for this for
100,200,300,400,500,600,700,800,900
Solution 1:[1]
Indeed, the font weight seems not to be handled on Android. I would remove the fontWeight field and set the weight with the fontFamily.
For example:
fontSize: 22,
fontFamily: "Montserrat-Light"
Solution 2:[2]
I solved this by removing the font weight field. Android/React native only supports certain font weights and my fontWeight: '500
was over-riding the fontFamily: "Montserrat-Light"
which already has the font weight build into it. Control the font weights using Light
, bold
...etc
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | JSharles |
Solution 2 | Matt Laszcz |