From 276c2bc7ad70927dd88bd93f0e35c0ac9a515e62 Mon Sep 17 00:00:00 2001 From: Yann Plantevin Date: Fri, 17 Apr 2015 16:07:10 +0200 Subject: [PATCH] [fixed] ProgressBar percentage issue when stacked Using stacked ProgressBar with a maximum superior to 100 could lead to rounding issues that made the bar incomplete. See issue #396 for mor details on the error --- src/ProgressBar.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ProgressBar.js b/src/ProgressBar.js index 0b981070c8..d80e92b174 100644 --- a/src/ProgressBar.js +++ b/src/ProgressBar.js @@ -27,7 +27,8 @@ const ProgressBar = React.createClass({ }, getPercentage(now, min, max) { - return Math.ceil((now - min) / (max - min) * 100); + let roundPrecision = 1000; + return Math.round(((now - min) / (max - min) * 100) * roundPrecision) / roundPrecision; }, render() {