Skip to content

Commit c1ab766

Browse files
fred2028Facebook Github Bot 2
authored andcommitted
Disable right-swipe from closed position
Summary: Disables right-swipe from closed position. Reviewed By: fkgozali Differential Revision: D3368525 fbshipit-source-id: b850458bd088dfda09bbbe4db71b33c3577a2167
1 parent d46ac11 commit c1ab766

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

Libraries/Experimental/SwipeableRow/SwipeableRow.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ const SwipeableRow = React.createClass({
166166
gestureState: Object,
167167
): boolean {
168168
// Decides whether a swipe is responded to by this component or its child
169-
return gestureState.dy < 10 && this._isValidSwipe(gestureState);
169+
return gestureState.dy < 10 && this._isValidSwipe(gestureState);
170170
},
171171

172172
_handlePanResponderGrant(event: Object, gestureState: Object): void {
@@ -175,7 +175,14 @@ const SwipeableRow = React.createClass({
175175

176176
_handlePanResponderMove(event: Object, gestureState: Object): void {
177177
this.props.onSwipeStart();
178-
this.state.currentLeft.setValue(this._previousLeft + gestureState.dx);
178+
179+
if (!this._isSwipingRightFromClosedPosition(gestureState)) {
180+
this.state.currentLeft.setValue(this._previousLeft + gestureState.dx);
181+
}
182+
},
183+
184+
_isSwipingRightFromClosedPosition(gestureState: Object): boolean {
185+
return this._previousLeft === CLOSED_LEFT_POSITION && gestureState.dx > 0;
179186
},
180187

181188
_onPanResponderTerminationRequest(event: Object, gestureState: Object): boolean {

0 commit comments

Comments
 (0)