From f98531317304284ac1cc6e71bbda1914a8c9629b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Stanislav?= Date: Tue, 18 Jul 2017 17:08:07 +0200 Subject: [PATCH] Keep progress bar within 0 and 100 ## Expected behaviour `` should show full progress bar. And the text should keep being `150%` ## Actual behaviour `` shows half full progress bar --- src/index.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.jsx b/src/index.jsx index 2c4e0bd..3041efb 100644 --- a/src/index.jsx +++ b/src/index.jsx @@ -44,7 +44,7 @@ class CircularProgressbar extends React.Component { const diameter = Math.PI * 2 * radius; const progressStyle = { strokeDasharray: `${diameter}px ${diameter}px`, - strokeDashoffset: `${((100 - this.state.percentage) / 100 * diameter)}px`, + strokeDashoffset: `${((100 - Math.min(Math.max(this.state.percentage, 0), 100)) / 100 * diameter)}px`, }; return (