From f85e001b00a065de2cb507b3c74b6b22ea65dc4f Mon Sep 17 00:00:00 2001 From: James Date: Thu, 12 May 2016 12:14:24 +1000 Subject: [PATCH 1/2] Fix for #664 navigationState issue on RN 0.24.1 When pushing new scene, it would duplicate the scene.key resulting in an error being thrown. --- src/DefaultRenderer.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/DefaultRenderer.js b/src/DefaultRenderer.js index 06a01fe94..6f3fb6580 100644 --- a/src/DefaultRenderer.js +++ b/src/DefaultRenderer.js @@ -64,6 +64,14 @@ export default class DefaultRenderer extends Component { return; } const scene = navigationState.children[navigationState.index]; + // (temp or production?) Fix for #664 + if (navigationState.index == 1) { + // Make sure the key names are not the same, or error will be thrown. + if (scene.key === navigationState.children[navigationState.index-1].key) { + // Change the new key name (just add current index to end of scene.key) + scene.key = scene.key+=navigationState.index; + } + } Actions.focus({ scene }); } From 0b00c1ff0b9791aad03346c051ed21a837fb0368 Mon Sep 17 00:00:00 2001 From: James Date: Thu, 12 May 2016 12:56:36 +1000 Subject: [PATCH 2/2] Fix if stmt, the fix now runs where navigationState.index > 0 Before this commit, my fix would only run when you're 1 scene deep. --- src/DefaultRenderer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/DefaultRenderer.js b/src/DefaultRenderer.js index 6f3fb6580..686d2fb4b 100644 --- a/src/DefaultRenderer.js +++ b/src/DefaultRenderer.js @@ -65,7 +65,7 @@ export default class DefaultRenderer extends Component { } const scene = navigationState.children[navigationState.index]; // (temp or production?) Fix for #664 - if (navigationState.index == 1) { + if (navigationState.index > 0) { // Make sure the key names are not the same, or error will be thrown. if (scene.key === navigationState.children[navigationState.index-1].key) { // Change the new key name (just add current index to end of scene.key)