diff --git a/src/common/Slider/Slider.js b/src/common/Slider/Slider.js index cf4553a95..bfa65cda0 100644 --- a/src/common/Slider/Slider.js +++ b/src/common/Slider/Slider.js @@ -8,9 +8,6 @@ class Slider extends Component { super(props); this.orientation = props.orientation; - this.onSlide = props.onSlide; - this.onComplete = props.onComplete; - this.onCancel = props.onCancel; } shouldComponentUpdate(nextProps, nextState) { @@ -20,6 +17,18 @@ class Slider extends Component { nextProps.className !== this.props.className; } + onSlide = (value) => { + this.props.onSlide(value); + } + + onComplete = (value) => { + this.props.onComplete(value); + } + + onCancel = () => { + this.props.onCancel(); + } + calculateSlidingValue = ({ mouseX, mouseY, sliderElement }) => { const { x: sliderX, y: sliderY, width: sliderWidth, height: sliderHeight } = sliderElement.getBoundingClientRect(); const sliderStart = this.orientation === 'horizontal' ? sliderX : sliderY;