Skip to content

Commit 3ded123

Browse files
committed
fix:修复Progress不展示value值站位问题
1 parent 4e1737d commit 3ded123

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

packages/core/src/Progress/index.tsx

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -83,18 +83,20 @@ const Progress: React.FC<ProgressProps> = ({
8383

8484
return (
8585
<View>
86-
<Svg width={width} height={width / 3}>
87-
<Defs>
88-
<LinearGradient id="grad" x1="0" y1="0" x2="1" y2="0">
89-
<Stop offset="0" stopColor={typeof color === 'string' ? color : color[0]} stopOpacity="1" />
90-
<Stop offset="1" stopColor={typeof color === 'string' ? color : color[1]} stopOpacity="1" />
91-
</LinearGradient>
92-
</Defs>
93-
<G origin={`${width / 2}, ${width / 2}`}>
94-
<Rect x={0} y={0} width={width} height={strokeWidth} rx={strokeWidth / 2} fill={bgColor} />
95-
<AnimatedRect x={0} y={0} width={progress} height={strokeWidth} rx={strokeWidth / 2} fill="url(#grad)" />
96-
</G>
97-
</Svg>
86+
<View>
87+
<Svg width={width} height={showLabel ? width / 3 : strokeWidth}>
88+
<Defs>
89+
<LinearGradient id="grad" x1="0" y1="0" x2="1" y2="0">
90+
<Stop offset="0" stopColor={typeof color === 'string' ? color : color[0]} stopOpacity="1" />
91+
<Stop offset="1" stopColor={typeof color === 'string' ? color : color[1]} stopOpacity="1" />
92+
</LinearGradient>
93+
</Defs>
94+
<G origin={`${width / 2}, ${width / 2}`}>
95+
<Rect x={0} y={0} width={width} height={strokeWidth} rx={strokeWidth / 2} fill={bgColor} />
96+
<AnimatedRect x={0} y={0} width={progress} height={strokeWidth} rx={strokeWidth / 2} fill="url(#grad)" />
97+
</G>
98+
</Svg>
99+
</View>
98100
{progressLabel}
99101
</View>
100102
);

0 commit comments

Comments
 (0)