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
This commit is contained in:
Luke Rhodes 2017-08-01 14:03:27 -07:00 committed by Facebook Github Bot
parent 471c9da4d6
commit cb1b1e58b3
1 changed files with 2 additions and 6 deletions

View File

@ -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;
},