Skip to content
Browse files

[Navigator: Prevent user from over-popping the routes.

If user taps the back button quickly, the app crashes becuase "pop"
internally only checks `this.state.presentedIndex` which does not
always update when transtion happens.

This diff addresses this issue.
  • Loading branch information...
Hedger Wang
Hedger Wang committed Jul 29, 2015
1 parent 8416691 commit 809a2dc1d65b12e895bd48043de0fa6ba0093838
Showing with 13 additions and 1 deletion.
  1. +13 −1 Libraries/CustomComponents/Navigator/Navigator.js
@@ -922,7 +922,19 @@ var Navigator = React.createClass({

pop: function() {
if (this.state.transitionQueue.length) {
// This is the workaround to prevent user from firing multiple `pop()`
// calls that may pop the routes beyond the limit.
// Because `this.state.presentedIndex` does not update until the
// transition starts, we can't reliably use `this.state.presentedIndex`
// to know whether we can safely keep popping the routes or not at this
// moment.

if (this.state.presentedIndex > 0) {


0 comments on commit 809a2dc

Please sign in to comment.
You can’t perform that action at this time.