From 11594b8531ee2611e2885b5511e09e3af6fdbaf5 Mon Sep 17 00:00:00 2001 From: Michal Kulinski Date: Mon, 7 Mar 2016 03:03:41 -0800 Subject: [PATCH] =?UTF-8?q?Fix=20navigation=20in=20UIExplorer.=20Use=20cur?= =?UTF-8?q?rent=20index=20instead=20of=20fixed=20valu=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary:Motivation: After second navigation event in UIExplorer, content in main page always stayed the same. Fix: For second and future navigation events use stack.index to retrieve state from stack.children. Closes https://github.com/facebook/react-native/pull/6312 Differential Revision: D3018119 Pulled By: andreicoman11 fb-gh-sync-id: 4c502c42a0cb7b240e558515fb8fd766d6e1f856 shipit-source-id: 4c502c42a0cb7b240e558515fb8fd766d6e1f856 --- Examples/UIExplorer/UIExplorerApp.android.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Examples/UIExplorer/UIExplorerApp.android.js b/Examples/UIExplorer/UIExplorerApp.android.js index 9e26c5f7b..026567bf5 100644 --- a/Examples/UIExplorer/UIExplorerApp.android.js +++ b/Examples/UIExplorer/UIExplorerApp.android.js @@ -105,8 +105,10 @@ class UIExplorerApp extends React.Component { } const {stack} = navigationState; const title = UIExplorerStateTitleMap(stack.children[stack.index]); - if (stack && stack.children[1]) { - const {key} = stack.children[1]; + const index = stack.children.length <= 1 ? 1 : stack.index; + + if (stack && stack.children[index]) { + const {key} = stack.children[index]; const ExampleModule = UIExplorerList.Modules[key]; const ExampleComponent = UIExplorerExampleList.makeRenderable(ExampleModule); return (