Disable right-swipe from closed position

Summary: Disables right-swipe from closed position.

Reviewed By: fkgozali

Differential Revision: D3368525

fbshipit-source-id: b850458bd088dfda09bbbe4db71b33c3577a2167
This commit is contained in:
Fred Liu 2016-05-31 16:23:51 -07:00 committed by Facebook Github Bot 2
parent d46ac110cd
commit c1ab766096
1 changed files with 9 additions and 2 deletions

View File

@ -166,7 +166,7 @@ const SwipeableRow = React.createClass({
gestureState: Object,
): boolean {
// Decides whether a swipe is responded to by this component or its child
return gestureState.dy < 10 && this._isValidSwipe(gestureState);
return gestureState.dy < 10 && this._isValidSwipe(gestureState);
},
_handlePanResponderGrant(event: Object, gestureState: Object): void {
@ -175,7 +175,14 @@ const SwipeableRow = React.createClass({
_handlePanResponderMove(event: Object, gestureState: Object): void {
this.props.onSwipeStart();
this.state.currentLeft.setValue(this._previousLeft + gestureState.dx);
if (!this._isSwipingRightFromClosedPosition(gestureState)) {
this.state.currentLeft.setValue(this._previousLeft + gestureState.dx);
}
},
_isSwipingRightFromClosedPosition(gestureState: Object): boolean {
return this._previousLeft === CLOSED_LEFT_POSITION && gestureState.dx > 0;
},
_onPanResponderTerminationRequest(event: Object, gestureState: Object): boolean {