Puneet Kansal
Puneet Kansal

Reputation: 21

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

Upvotes: 1

Views: 6016

Answers (2)

Matt Laszcz
Matt Laszcz

Reputation: 409

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

Upvotes: 0

JSharles
JSharles

Reputation: 677

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"

Upvotes: 3

Related Questions