Fix Js error in Navigator
Summary: public In Navigator, there are several places that mutate `this.state.presentedIndex` with the express `this.state.presentedIndex = destIndex` instead of calling `this.setState`, which creates the problem that not all internal states are updated within the same React update cycle. One of the symptoms is that over-swiping within the Navigator may throw JS error due to `this.state.sceneConfigStack` and `this.state.presentedIndex` are not both updated. The workaround is to bypass the over-swiping gesture to avoid JS error. Reviewed By: ericvicenti Differential Revision: D2557140 fb-gh-sync-id: 1e5c9047ed17c04a63e2a568118848b00723fb1d
This commit is contained in:
parent
4ac3c4a853
commit
06a154e061
|
@ -591,6 +591,9 @@ var Navigator = React.createClass({
|
|||
|
||||
_handleMoveShouldSetPanResponder: function(e, gestureState) {
|
||||
var sceneConfig = this.state.sceneConfigStack[this.state.presentedIndex];
|
||||
if (!sceneConfig) {
|
||||
return false;
|
||||
}
|
||||
this._expectingGestureGrant = this._matchGestureAction(this._eligibleGestures, sceneConfig.gestures, gestureState);
|
||||
return !!this._expectingGestureGrant;
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue