From cb1b1e58b372bea23a2302db2f4c0eba85b4a17a Mon Sep 17 00:00:00 2001 From: Luke Rhodes Date: Tue, 1 Aug 2017 14:03:27 -0700 Subject: [PATCH] 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 https://github.com/facebook/react-native/pull/14900 Differential Revision: D5539787 Pulled By: hramos fbshipit-source-id: 6c826ada4a7f36607c65508ced6c9dce32002f74 --- Libraries/Experimental/SwipeableRow/SwipeableRow.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Libraries/Experimental/SwipeableRow/SwipeableRow.js b/Libraries/Experimental/SwipeableRow/SwipeableRow.js index bdba02afa8cafb..42f34a480a7bab 100644 --- a/Libraries/Experimental/SwipeableRow/SwipeableRow.js +++ b/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; },