Skip to content

Commit

Permalink
Fix percentage in initial state for Slider
Browse files Browse the repository at this point in the history
getInitialState() in Slider doesn't compute percentage value correctly, like setValue() does.
  • Loading branch information
heindor0 committed Mar 3, 2015
1 parent d30b10a commit e97d59d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/js/slider.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ var Slider = React.createClass({
getInitialState: function() {
var value = this.props.value;
if (value == null) value = this.props.defaultValue;
var percent = value / this.props.max;
var percent = (value - this.props.min) / (this.props.max - this.props.min);
if (isNaN(percent)) percent = 0;
return {
value: value,
Expand Down

0 comments on commit e97d59d

Please sign in to comment.