Skip to content

Commit

Permalink
Merge pull request #280 from njdancer/fix/snap-back-on-mobile
Browse files Browse the repository at this point in the history
fix: snap back on mobile devices
  • Loading branch information
kris-ellery authored Jun 3, 2023
2 parents 5e81291 + 6ca5853 commit 874122b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/components/ReactSlider/ReactSlider.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,8 @@ class ReactSlider extends React.Component {
this.onEnd(this.getMouseEventMap());
};

onTouchEnd = () => {
onTouchEnd = e => {
e.preventDefault();
this.onEnd(this.getTouchEventMap());
};

Expand Down Expand Up @@ -849,7 +850,10 @@ class ReactSlider extends React.Component {
}

move(newValue) {
const { index, value } = this.state;
// Clone this.state.value since we'll modify it temporarily
// eslint-disable-next-line zillow/react/no-access-state-in-setstate
const value = this.state.value.slice();
const { index } = this.state;
const { length } = value;

// Short circuit if the value is not changing
Expand Down

0 comments on commit 874122b

Please # to comment.