From 61025a9b33c1f835526748f2a06c9773c3bfddb6 Mon Sep 17 00:00:00 2001 From: Ognen Ivanovski Date: Wed, 6 Jan 2016 10:32:23 -0800 Subject: [PATCH] bugfix: NavigatoriOS doesn't update any scenes when 0th scene is replaced Summary: Calling navigator.replace(0, scene) has no effect. This is because 0 is false in Javascript so when this.state.updatingAllIndicesAtOrBeyond == 0 (meaning update all indices starting with 0) The whole expression evaluates to 0, i.e. false -> therefore no update happens. Explicitly checking for not-equal to null (!= will convert undefined to null automatically) fixes the issue. Closes https://github.com/facebook/react-native/pull/5155 Reviewed By: svcscm Differential Revision: D2807397 Pulled By: nicklockwood fb-gh-sync-id: 519a4ab35c86b0b608808b36593f5f8c2ecd1561 --- Libraries/Components/Navigation/NavigatorIOS.ios.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Libraries/Components/Navigation/NavigatorIOS.ios.js b/Libraries/Components/Navigation/NavigatorIOS.ios.js index e21cc6d85..6635a25bb 100644 --- a/Libraries/Components/Navigation/NavigatorIOS.ios.js +++ b/Libraries/Components/Navigation/NavigatorIOS.ios.js @@ -639,7 +639,7 @@ var NavigatorIOS = React.createClass({ var {component, wrapperStyle, passProps, ...route} = route; var {itemWrapperStyle, ...props} = this.props; var shouldUpdateChild = - this.state.updatingAllIndicesAtOrBeyond && + this.state.updatingAllIndicesAtOrBeyond != null && this.state.updatingAllIndicesAtOrBeyond >= i; var Component = component; return (