From c47631d30cc74d75bbbe541c27b6386adad6ab8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=B3=E5=BB=B7=E5=AE=89?= <73953029+nrps9909@users.noreply.github.com> Date: Fri, 28 Aug 2026 15:52:14 +0800 Subject: [PATCH] fix: honor zero rail width --- src/Circle/index.tsx | 2 +- src/Line.tsx | 2 +- tests/index.spec.js | 15 +++++++++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/Circle/index.tsx b/src/Circle/index.tsx index cde8157..7a06b32 100644 --- a/src/Circle/index.tsx +++ b/src/Circle/index.tsx @@ -187,7 +187,7 @@ const Circle: React.FC = (props) => { cy={halfSize} stroke={railColor} strokeLinecap={mergedStrokeLinecap} - strokeWidth={railWidth || strokeWidth} + strokeWidth={railWidth ?? strokeWidth} style={{ ...circleStyle, ...styles.rail }} /> )} diff --git a/src/Line.tsx b/src/Line.tsx index cfb8c17..d2b1e46 100644 --- a/src/Line.tsx +++ b/src/Line.tsx @@ -63,7 +63,7 @@ const Line: React.FC = (props) => { d={pathString} strokeLinecap={strokeLinecap} stroke={railColor} - strokeWidth={railWidth || strokeWidth} + strokeWidth={railWidth ?? strokeWidth} fillOpacity="0" /> {percentList.map((ptg, index) => { diff --git a/tests/index.spec.js b/tests/index.spec.js index 294f352..6b9ddc2 100644 --- a/tests/index.spec.js +++ b/tests/index.spec.js @@ -39,6 +39,21 @@ describe('Progress', () => { }); }); + it('should support zero rail width', () => { + const { container } = render( +
+ + +
, + ); + + expect(container.querySelector('.rc-progress-line-rail')).toHaveAttribute('stroke-width', '0'); + expect(container.querySelector('.rc-progress-circle-rail')).toHaveAttribute( + 'stroke-width', + '0', + ); + }); + describe('Circle', () => { it('change with animation', () => { function Demo() {