Browse files

Navigator: null check on gesture.overswipe to prevent crash

Sometimes, `gesture.overswipe` can be `null`/`undefined` in `_moveAttachedGesture` resulting in a crash. This change adds a null check to avoid the crash. `_matchGestureAction` has a similar check so it looks like this case was overlooked in `_moveAttachedGesture`.

**Test plan (required)**

My team's app is using this change.

Adam Comella
Microsoft Corp.
Closes #11017

Differential Revision: D4207277

Pulled By: ericvicenti

fbshipit-source-id: a22817c2ebec1c996583269a59d6767f5713771b
  • Loading branch information...
rigdern authored and Facebook Github Bot committed Nov 20, 2016
1 parent dcbcda7 commit 54e947152f4d534b7352b89bcf3d7e4dfde21538
Showing with 1 addition and 1 deletion.
  1. +1 −1 Libraries/CustomComponents/Navigator/Navigator.js
@@ -914,7 +914,7 @@ var Navigator = React.createClass({
if (this._doesGestureOverswipe(this.state.activeGesture)) {
if (gesture.overswipe && this._doesGestureOverswipe(this.state.activeGesture)) {
var frictionConstant = gesture.overswipe.frictionConstant;
var frictionByDistance = gesture.overswipe.frictionByDistance;
var frictionRatio = 1 / ((frictionConstant) + (Math.abs(nextProgress) * frictionByDistance));

0 comments on commit 54e9471

Please sign in to comment.