From f1106198a0c5be02f1a0f17a7ff4c4595bd51454 Mon Sep 17 00:00:00 2001 From: Moksh Upadhyay Date: Tue, 1 Dec 2026 11:34:20 +0530 Subject: [PATCH] fix: avoid NaN transform when Circle gapPosition is undefined --- src/Circle/util.ts | 4 ++-- tests/index.spec.js | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Circle/util.ts b/src/Circle/util.ts index b57ee71..6c2b0b8 100644 --- a/src/Circle/util.ts +++ b/src/Circle/util.ts @@ -21,12 +21,12 @@ export const getCircleStyle = ( const positionDeg = gapDegree === 0 ? 0 - : { + : ({ bottom: 0, top: 180, left: 90, right: -90, - }[gapPosition]; + }[gapPosition || 'bottom'] ?? 0); let strokeDashoffset = ((100 - percent) / 100) * perimeterWithoutGap; // Fix percent accuracy when strokeLinecap is round diff --git a/tests/index.spec.js b/tests/index.spec.js index 6b9ddc2..c39facc 100644 --- a/tests/index.spec.js +++ b/tests/index.spec.js @@ -266,4 +266,12 @@ describe('Progress', () => { expect(container.firstChild).toMatchSnapshot(); unmount(); }); + + it('Circle should not produce NaN transform when gapPosition is undefined with gapDegree', () => { + const { container } = render(); + const rail = container.querySelector('.rc-progress-circle-rail'); + const path = container.querySelector('.rc-progress-circle-path'); + expect(rail.style.transform).toBe('rotate(125deg)'); + expect(path.style.transform).toBe('rotate(125deg)'); + }); });