TVke / react-native-tailwindcss

A react-native style system based on TailwindCSS
https://tvke.github.io/react-native-tailwindcss/
MIT License
565 stars 34 forks source link

Overwrite fontWeight values in tailwind.config #33

Closed jf-ouellette closed 4 years ago

jf-ouellette commented 4 years ago

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 4 years ago

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

jf-ouellette commented 4 years ago

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 4 years ago

Hi @jf-ouellette

Maybe you can modify the font file itself? 🤔

Thank you for using react-native-tailwindcss.

greetings Thomas