React-native-linear-gradient: Use linear gradient for border color?

Created on 5 Oct 2016  路  4Comments  路  Source: react-native-linear-gradient/react-native-linear-gradient

Is there a way to use this package to set border-color to a gradient?

enhancement

Most helpful comment

Easiest way to immediately accomplish the same effect: Nest one View within another View, with the "border with" being the padding on the outer container (or margin on inner). Then just wrap the inner View with the linear gradient, and make sure the inner View has a background color (anything besides 'transparent').

All 4 comments

This would be a pretty serious undertaking, and currently this is not supported. I am not sure that it is really within "scope" of the project either as this is intended to simply "draw" a linear gradient.

Easiest way to immediately accomplish the same effect: Nest one View within another View, with the "border with" being the padding on the outer container (or margin on inner). Then just wrap the inner View with the linear gradient, and make sure the inner View has a background color (anything besides 'transparent').

Would be super cool to support gradient borders. The challenge with @codinronan's trick is that you cannot do transparent button backgrounds (and thus accomodate image based, multifarious or gradient backgrounds of containing views). Any ideas where one would start to alter LinearGradient to support truly gradient borders?

I'm closing this since this is outside the scope of the library, and a simple workaround exists.

Was this page helpful?
0 / 5 - 0 ratings