jaredh159 / tailwind-react-native-classnames

simple, expressive API for tailwindcss + react-native
2.08k stars 84 forks source link

Support adding gradient to background #219

Closed karwan-ali closed 1 year ago

karwan-ali commented 1 year ago

Hello,

I was wondering if it is possible to implement gradient to background like in normal tailwindcss?

Example: bg-gradient-to-b

My React Native app can't find gradient styles. See attached images.

Screenshot 2023-02-12 at 21 20 19

I also get error when adding "from-black to-white":

Screenshot 2023-02-12 at 21 21 04
jaredh159 commented 1 year ago

We don't support gradients at all. That's because this library is only aiming to cover tailwindcss utilities that map directly to core style props in RN native. Gradients are not supported directly in RN (native).

I'm guessing you might be using RN web? If so, check out the discussion here: https://github.com/jaredh159/tailwind-react-native-classnames/discussions/125

also:

https://github.com/jaredh159/tailwind-react-native-classnames/issues/156

karwan-ali commented 1 year ago

Oh sorry, I was going to write another comment as I found a library that took care of this. I was not aware that gradient was not supported in RN. Thank you for the fast reply!

If other people are interested in what library I used for implementing gradient: expo-linear-gradient