'react-native-render-html' can't change font family for <strong> tag

2k Views Asked by At

I'm using react-native-render-html 6.3.4, attempting to use custom font, but can't seem to change the font family for 'strong' and 'em' tags. Other attributes are working like font size or font style but not font family.

        const html = `<p><strong> Custom font bold.</strong> Regular text font family. </p>`;

        <HTML
          source={{ html }}
          systemFonts={systemFonts}
          tagsStyles={{
            strong: {
              fontFamily: 'PLEC-Regular',
              fontStyle: 'italic',
              fontSize: 30,
            },
          }}
        />```
1

There are 1 best solutions below

0
On

This is how I solved my problem. I don't know why but the fontWeight must be different '700'

<HTML
          source={{ html }}
          systemFonts={systemFonts}
          tagsStyles={{
            strong: {
              fontFamily: 'PLEC-Regular',
              fontStyle: 'italic',
              fontSize: 30,
              fontWeight:'800',
            },
          }}
        />