Skip to content

Commit 276c2bc

Browse files
committedApr 17, 2015
[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 react-bootstrap#396 for mor details on the error
1 parent f167c13 commit 276c2bc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed
 

‎src/ProgressBar.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ const ProgressBar = React.createClass({
2727
},
2828

2929
getPercentage(now, min, max) {
30-
return Math.ceil((now - min) / (max - min) * 100);
30+
let roundPrecision = 1000;
31+
return Math.round(((now - min) / (max - min) * 100) * roundPrecision) / roundPrecision;
3132
},
3233

3334
render() {

0 commit comments

Comments
 (0)