jfilter / react-native-onboarding-swiper

🛳 Delightful onboarding for your React-Native app
https://www.npmjs.com/package/react-native-onboarding-swiper
Other
971 stars 179 forks source link

Linear Gradient as background fill #78

Open Michaelvons opened 4 years ago

Michaelvons commented 4 years ago

How can linear-gradient be implemented as a background fill?

montycheese commented 4 years ago

@Michaelvons ,

I added a workaround to use linear gradients this on a fork I created. It's not pull-request worthy but hopefully will help you out. It works for my usecase.

One thing to note is that the backgroundColor prop is heavily coupled into the codebase. It affects the animations and transitions, so you'll still have to specify a backgroundColor even though it isn't relevant for gradient backgrounds (with my workaround)

https://github.com/montycheese/react-native-onboarding-swiper/commit/13f16b8e543881ee281a943f877fc951c2e71051

darrylyoung commented 7 months ago

Good idea!

For anyone else looking to do this, you can make the same (or similar) changes as shown in the example above, and then run the following to create a patch which can install during npm i as part of the postinstall script.

npx patch-package react-native-onboarding-swiper