From 97137e8bccdf04bde18fd150e20f9bf835cfaa82 Mon Sep 17 00:00:00 2001 From: Eric Vicenti Date: Tue, 19 May 2015 18:45:08 -0700 Subject: [PATCH] [ReactNative] Navigator clean scenes popped with gesture Summary: Fixes https://github.com/facebook/react-native/issues/1252 Scenes dismissed/popped via a gesture were not being removed. This is probably a regression from an earlier refactor. Test plan: log statements after scene focusing now reports that `navigator.getCurrentRoutes().length` lowers after gesture. Tested on UIExplorer Navigator example Closes https://github.com/facebook/react-native/pull/1346 Github Author: Eric Vicenti @public Test Plan: Imported from GitHub, without a `Test Plan:` line. --- Libraries/CustomComponents/Navigator/Navigator.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Libraries/CustomComponents/Navigator/Navigator.js b/Libraries/CustomComponents/Navigator/Navigator.js index 063012c14a78b7..2327316fc3c1f6 100644 --- a/Libraries/CustomComponents/Navigator/Navigator.js +++ b/Libraries/CustomComponents/Navigator/Navigator.js @@ -827,7 +827,16 @@ var Navigator = React.createClass({ } } else { // The gesture has enough velocity to complete, so we transition to the gesture's destination - this._transitionTo(destIndex, transitionVelocity); + this._transitionTo( + destIndex, + transitionVelocity, + null, + () => { + if (releaseGestureAction === 'pop') { + this._cleanScenesPastIndex(destIndex); + } + } + ); } this._detachGesture(); },