Permalink
Browse files

Fixes unintended side effects caused by #14684

Summary:
I had fixed this locally but hadn't updated the original pull request, sorry. This commit is working for us in production.
Closes #14900

Differential Revision: D5539787

Pulled By: hramos

fbshipit-source-id: 6c826ada4a7f36607c65508ced6c9dce32002f74
  • Loading branch information...
lprhodes authored and grabbou committed Aug 1, 2017
1 parent 5808059 commit 4d572cd0f84ead8e5ecca286013a20f324f021e2
Showing with 2 additions and 6 deletions.
  1. +2 −6 Libraries/Experimental/SwipeableRow/SwipeableRow.js
@@ -72,7 +72,6 @@ const SwipeableRow = createReactClass({
propTypes: {
children: PropTypes.any,
isOpen: PropTypes.bool,
preventSwipeLeft: PropTypes.bool,
preventSwipeRight: PropTypes.bool,
maxSwipeDistance: PropTypes.number.isRequired,
onOpen: PropTypes.func.isRequired,
@@ -110,7 +109,6 @@ const SwipeableRow = createReactClass({
getDefaultProps(): Object {
return {
isOpen: false,
preventSwipeLeft: false,
preventSwipeRight: false,
maxSwipeDistance: 0,
onOpen: emptyFunction,
@@ -339,12 +337,10 @@ const SwipeableRow = createReactClass({
// Ignore swipes due to user's finger moving slightly when tapping
_isValidSwipe(gestureState: Object): boolean {
if (this.props.preventSwipeLeft && gestureState.dx < 0) {
return false;
}
if (this.props.preventSwipeRight && gestureState.dx > 0) {
if (this.props.preventSwipeRight && this._previousLeft === CLOSED_LEFT_POSITION && gestureState.dx > 0) {
return false;
}
return Math.abs(gestureState.dx) > HORIZONTAL_SWIPE_DISTANCE_THRESHOLD;
},

0 comments on commit 4d572cd

Please sign in to comment.