dripsy icon indicating copy to clipboard operation
dripsy copied to clipboard

Heading (H1, H2, H3, ...) doesn't apply the custom fontWeight property

Open alexis-regnaud opened this issue 3 years ago • 4 comments

I use customFont and try to change the default fontWeight for each heading within the theme, but it is not applied.

This is an example with <H1> and <Text variant="h1"> :

  • theme: image

  • code: image

  • app: image

Only <Text> has the correct fontWeight

alexis-regnaud avatar Dec 27 '21 18:12 alexis-regnaud

Is this on Android?

nandorojo avatar Dec 27 '21 18:12 nandorojo

Yes

alexis-regnaud avatar Dec 27 '21 18:12 alexis-regnaud

Yeah it’s a known bug, it’s because expo/html-elements sets fontWeight when it shouldn’t. The solution would be to copy the expo components into Dripsy. I’d be happy to review a PR.

nandorojo avatar Dec 27 '21 18:12 nandorojo

Here is another solution that is working for me. Setting the fontWeight to normal in the style prop:

<H1 style={{fontWeight: "normal"}}>Title</H1>

~~Edit: this was when using a custom font., so maybe slightly unrelated from the OPs issue. I was using the fontWeight property in the theme to use a custom font and on Android it was not using that font unless I did this.~~

Edit2: Realized the original posts looks to be using multiple fonts and does set a custom font. I have verified that setting the style prop also works in this situation

levic92 avatar Apr 22 '22 23:04 levic92

I think I'm going to close this since it's an issue with @expo/html-elements. Or maybe we apply that style under the hood as @levic92 mentioned.

nandorojo avatar Sep 15 '22 00:09 nandorojo