Fix navigation jump on multi-tap
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
This commit is contained in:
parent
550fed5ce8
commit
b3886652ab
|
@ -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,
|
||||
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue