Last active
March 4, 2017 18:10
-
-
Save talkol/e21dea4a422806d5c1709e88cd2c9f2d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_handlePanResponderMove(event: Object, gestureState: Object): void { | |
if (this._isSwipingExcessivelyRightFromClosedPosition(gestureState)) { | |
return; | |
} | |
this.props.onSwipeStart(); | |
if (this._isSwipingRightFromClosed(gestureState)) { | |
this._swipeSlowSpeed(gestureState); | |
} else { | |
this._swipeFullSpeed(gestureState); | |
} | |
}, | |
_isSwipingRightFromClosed(gestureState: Object): boolean { | |
const gestureStateDx = IS_RTL ? -gestureState.dx : gestureState.dx; | |
return this._previousLeft === CLOSED_LEFT_POSITION && gestureStateDx > 0; | |
}, | |
_swipeFullSpeed(gestureState: Object): void { | |
this.state.currentLeft.setValue(this._previousLeft + gestureState.dx); | |
}, | |
_swipeSlowSpeed(gestureState: Object): void { | |
this.state.currentLeft.setValue( | |
this._previousLeft + gestureState.dx / SLOW_SPEED_SWIPE_FACTOR, | |
); | |
}, | |
_isSwipingExcessivelyRightFromClosedPosition(gestureState: Object): boolean { | |
const gestureStateDx = IS_RTL ? -gestureState.dx : gestureState.dx; | |
return ( | |
this._isSwipingRightFromClosed(gestureState) && | |
gestureStateDx > RIGHT_SWIPE_THRESHOLD | |
); | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment