Cool Dunno
Cool Dunno

Reputation: 41

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

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

Upvotes: 2

Views: 2708

Answers (1)

Michael T-rex
Michael T-rex

Reputation: 11

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

Upvotes: 1

Related Questions