How can I change the font size of the default font in React Native?

324 views Asked by At

The font I use does not support every alphabet. For example, if the user uses Chinese letters, the default font is used instead of my font in the application. In this case, there is a problem. The appropriate fontSize value for my font is 24. However, when using the default font, the value 24 for the default font is too big and breaks the UI. How can I change the fontSize of the default font in this case?

<Text style={{ fontFamily: "Abc-Font" fontSize: 24 }}>{text}</Text>
1

There are 1 answers

3
Harsh Kukarwadiya On

You have to check that if the application is throughing error of fontfamily e.g

Unrecognised font family 

If yes than you can render it conditionally

{fontfamilyError ? <Text>{text}</Text>:<Text style={{ fontFamily: "Abc-Font" fontSize: 24 }}>{text}</Text> }