Skip to content

Commit

Permalink
Fix navigation jump on multi-tap
Browse files Browse the repository at this point in the history
Summary:
On iOS, if a non-selected breadcrumb is tapped multiple times, the navigator will transition to the tapped breadcrumb, then back to the previously selected breadcrumb. Then, when another breadcrumb is tapped, it would go to the previously multi-tapped breadcrumb.

This seems to be because transitions are queued when they shouldn't be. I've reverted to the way it was before PR 8701, but added a `transitionQueue.length === 0`. This should solve the race condition from 8701, ensuring all transitions in the queue are flushed in sequence, and thus landing on the finally tapped one.

Reviewed By: hedgerwang

Differential Revision: D3469901

fbshipit-source-id: 0143a27d6c875d47d28b77eed4e5a28b1c40c8bb
  • Loading branch information
fred2028 authored and Facebook Github Bot 7 committed Jun 22, 2016
1 parent 550fed5 commit b388665
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Libraries/CustomComponents/Navigator/Navigator.js
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,12 @@ var Navigator = React.createClass({
},

_transitionTo: function(destIndex, velocity, jumpSpringTo, cb) {
if (
destIndex === this.state.presentedIndex &&
this.state.transitionQueue.length === 0
) {
return;
}
if (this.state.transitionFromIndex !== null) {
this.state.transitionQueue.push({
destIndex,
Expand All @@ -381,9 +387,7 @@ var Navigator = React.createClass({
});
return;
}
if (destIndex === this.state.presentedIndex) {
return;
}

this.state.transitionFromIndex = this.state.presentedIndex;
this.state.presentedIndex = destIndex;
this.state.transitionCb = cb;
Expand Down

0 comments on commit b388665

Please sign in to comment.