Skip to content

Commit

Permalink
Merge pull request xinthink#126 from mmazzarolo/patch-1
Browse files Browse the repository at this point in the history
Slider emits confirmed value on TouchUp
  • Loading branch information
xinthink committed Mar 27, 2016
2 parents 03ddac0 + b7d20a7 commit 2acd041
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/mdl/Slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,12 @@ class Slider extends Component {
}
}

_emitTouchUp() {
if (this.props.onTouchUp) {
this.props.onTouchUp(this._value);
}
}

_aniUpdateValue(value) {
if (!this._trackTotalLength) {
return;
Expand Down Expand Up @@ -130,6 +136,7 @@ class Slider extends Component {
break;
case 'TOUCH_UP':
this._confirmUpdateValueByTouch(evt);
this._emitTouchUp();
break;
case 'TOUCH_CANCEL':
// should not use the coordination inside a cancelled event
Expand Down Expand Up @@ -287,6 +294,9 @@ Slider.propTypes = {

// Callback when value changed
onChange: PropTypes.func,

// Callback when thumb is lifted
onTouchUp: PropTypes.func,
};

// ## <section id='defaults'>Defaults</section>
Expand Down

0 comments on commit 2acd041

Please sign in to comment.