diff options
Diffstat (limited to 'src/components/GradientFill.tsx')
-rw-r--r-- | src/components/GradientFill.tsx | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/components/GradientFill.tsx b/src/components/GradientFill.tsx index fa39577d4..3dff404d7 100644 --- a/src/components/GradientFill.tsx +++ b/src/components/GradientFill.tsx @@ -14,10 +14,16 @@ export function GradientFill({ | typeof tokens.gradients.summer | typeof tokens.gradients.nordic }) { + if (gradient.values.length < 2) { + throw new Error('Gradient must have at least 2 colors') + } + return ( <LinearGradient - colors={gradient.values.map(c => c[1])} - locations={gradient.values.map(c => c[0])} + colors={gradient.values.map(c => c[1]) as [string, string, ...string[]]} + locations={ + gradient.values.map(c => c[0]) as [number, number, ...number[]] + } start={{x: 0, y: 0}} end={{x: 1, y: 1}} style={[a.absolute, a.inset_0]} |