Draw a gradient
Set the colors, stops, and direction of a View’s linear gradient background.
Set a container's style.background to a linear gradient. The endpoints use fractions of the view's width and height, so the fill follows the view when it resizes.
import { View } from 'nitro-ui-renderer'
export function SkySwatch() {
return (
<View
layout={{ height: 80 }}
style={{
cornerRadius: 12,
background: {
type: 'linear-gradient',
colors: [0x273c5aff, 0xf0b77aff],
start: { x: 0, y: 0 },
end: { x: 1, y: 1 },
},
}}
/>
)
}Supply at least two colors. For uneven spacing, pass one locations value per color, in ascending order between zero and one.