Skip to content

Commit

Permalink
add check for started location
Browse files Browse the repository at this point in the history
format code
  • Loading branch information
Luke Dubert committed Mar 2, 2016
1 parent f6b0c13 commit a178be0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Libraries/CustomComponents/Navigator/Navigator.js
Original file line number Diff line number Diff line change
Expand Up @@ -791,21 +791,26 @@ var Navigator = React.createClass({
}
var isTravelVertical = gesture.direction === 'top-to-bottom' || gesture.direction === 'bottom-to-top';
var isTravelInverted = gesture.direction === 'right-to-left' || gesture.direction === 'bottom-to-top';
var startedLoc = isTravelVertical ? gestureState.y0 : gestureState.x0;
var currentLoc = isTravelVertical ? gestureState.moveY : gestureState.moveX;
var travelDist = isTravelVertical ? gestureState.dy : gestureState.dx;
var oppositeAxisTravelDist =
isTravelVertical ? gestureState.dx : gestureState.dy;
var edgeHitWidth = gesture.edgeHitWidth;
if (isTravelInverted) {
startedLoc = -startedLoc;
currentLoc = -currentLoc;
travelDist = -travelDist;
oppositeAxisTravelDist = -oppositeAxisTravelDist;
edgeHitWidth = isTravelVertical ?
-(SCREEN_HEIGHT - edgeHitWidth) :
-(SCREEN_WIDTH - edgeHitWidth);
}
if (startedLoc == 0) {
startedLoc = currentLoc;
}
var moveStartedInRegion = gesture.edgeHitWidth == null ||
currentLoc < edgeHitWidth;
startedLoc < edgeHitWidth;
if (!moveStartedInRegion) {
return false;
}
Expand Down

0 comments on commit a178be0

Please # to comment.