Skip to content

Commit

Permalink
fix:修复Progress不展示value值站位问题
Browse files Browse the repository at this point in the history
  • Loading branch information
SunLxy committed Jul 12, 2023
1 parent 4e1737d commit 3ded123
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions packages/core/src/Progress/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,18 +83,20 @@ const Progress: React.FC<ProgressProps> = ({

return (
<View>
<Svg width={width} height={width / 3}>
<Defs>
<LinearGradient id="grad" x1="0" y1="0" x2="1" y2="0">
<Stop offset="0" stopColor={typeof color === 'string' ? color : color[0]} stopOpacity="1" />
<Stop offset="1" stopColor={typeof color === 'string' ? color : color[1]} stopOpacity="1" />
</LinearGradient>
</Defs>
<G origin={`${width / 2}, ${width / 2}`}>
<Rect x={0} y={0} width={width} height={strokeWidth} rx={strokeWidth / 2} fill={bgColor} />
<AnimatedRect x={0} y={0} width={progress} height={strokeWidth} rx={strokeWidth / 2} fill="url(#grad)" />
</G>
</Svg>
<View>
<Svg width={width} height={showLabel ? width / 3 : strokeWidth}>
<Defs>
<LinearGradient id="grad" x1="0" y1="0" x2="1" y2="0">
<Stop offset="0" stopColor={typeof color === 'string' ? color : color[0]} stopOpacity="1" />
<Stop offset="1" stopColor={typeof color === 'string' ? color : color[1]} stopOpacity="1" />
</LinearGradient>
</Defs>
<G origin={`${width / 2}, ${width / 2}`}>
<Rect x={0} y={0} width={width} height={strokeWidth} rx={strokeWidth / 2} fill={bgColor} />
<AnimatedRect x={0} y={0} width={progress} height={strokeWidth} rx={strokeWidth / 2} fill="url(#grad)" />
</G>
</Svg>
</View>
{progressLabel}
</View>
);
Expand Down

0 comments on commit 3ded123

Please sign in to comment.