[ReactNative] Avoid Navigator invariant in edge case

Summary:
It is very rare, but sometimes there is no active gesture when the responder gets released. This will avoid a redbox in that case

@public

Test Plan: Saw the redbox. No longer see the redbox. Hardcoded missing activeGesture while responder and verified no redbox
This commit is contained in:
Eric Vicenti 2015-04-29 00:38:40 -07:00
parent 43e7e69841
commit 349f8b942a

View File

@ -716,6 +716,10 @@ var Navigator = React.createClass({
_handlePanResponderRelease: function(e, gestureState) {
var sceneConfig = this.state.sceneConfigStack[this.state.presentedIndex];
var releaseGestureAction = this.state.activeGesture;
if (!releaseGestureAction) {
// The gesture may have been detached while responder, so there is no action here
return;
}
var releaseGesture = sceneConfig.gestures[releaseGestureAction];
var destIndex = this.state.presentedIndex + this._deltaForGestureAction(this.state.activeGesture);
if (this.spring.getCurrentValue() === 0) {