1

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,
            },
          }}
        />```
Cool Dunno
  • 31
  • 2
  • See https://stackoverflow.com/questions/38815234/how-to-add-fonts-for-different-font-weights-for-react-native-android-project/70247374#70247374 – Jules Sam. Randolph May 17 '22 at 15:40
  • Does this answer your question? [How to add fonts for different font weights for react-native android project?](https://stackoverflow.com/questions/38815234/how-to-add-fonts-for-different-font-weights-for-react-native-android-project) – CoatedMoose Sep 29 '22 at 20:54

1 Answers1

0

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',
            },
          }}
        />