Skip to content

Commit

Permalink
fix scrollview inside deck when vertical swipe is disabled fixes alex…
Browse files Browse the repository at this point in the history
  • Loading branch information
Morgan Laupies committed Dec 13, 2017
1 parent c5be8d0 commit a1759fb
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions Swiper.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,15 @@ class Swiper extends React.Component {
onStartShouldSetPanResponder: (event, gestureState) => true,
onMoveShouldSetPanResponder: (event, gestureState) => false,

onMoveShouldSetPanResponderCapture: (evt, gestureState) =>
Math.sqrt(Math.pow(gestureState.dx, 2) + Math.pow(gestureState.dy, 2)) > 10,

onMoveShouldSetPanResponderCapture: (evt, gestureState) => {
const isVerticalSwipe = Math.sqrt(
Math.pow(gestureState.dx, 2) < Math.pow(gestureState.dy, 2)
);
if (!this.props.verticalSwipe && isVerticalSwipe) {
return false;
}
return Math.sqrt(Math.pow(gestureState.dx, 2) + Math.pow(gestureState.dy, 2)) > 10
},
onPanResponderGrant: this.onPanResponderGrant,
onPanResponderMove: this.onPanResponderMove,
onPanResponderRelease: this.onPanResponderRelease,
Expand Down

0 comments on commit a1759fb

Please sign in to comment.