TVke/react-native-tailwindcss

Overwrite fontWeight values in tailwind.config

jf-ouellette opened this issue · 3 comments

Hi!

I've been trying to overwrite the value for fontSemibold in my tailwind.config, but I am not able to make it work. I ended up comparing fontSize.js and fontWeight.js in the node_modules and I noticed that the first one uses theme.fontSize in the generator.generate function while the other uses an (hardcoded?) array.

Does that mean that we can't overwrite the values for fontWeight, or am I just missing something?

I am using version 1.1.9 of the plugin.

Thank you so much!

TVke commented

Hi @jf-ouellette

The font size is indeed adjustable and the fontWeight property is not this is because react native only allows these values.
https://react-native.org/doc/text-style-props.html#fontweight
As specified in the docs there are only these options possible and that is why it is not adjustable

greetings
Thomas

Hi @TVke

That makes sense.

I wanted to adjust the values because when I use semiBold, it works well with iOS, but not with Android. My font has 'normal' weight instead of 'bold' weight, so I end up needing to overwrite the value like so : semibold: Platform.OS === 'ios' ? '600' : 'bold'.

I'll see if I can come up with another solution.

Thank you, Thomas!
Jean-François

TVke commented

Hi @jf-ouellette

Maybe you can modify the font file itself? 🤔

Thank you for using react-native-tailwindcss.

greetings
Thomas