From 898cf7ae2703656459f28e21123f3b0f8a40b22e Mon Sep 17 00:00:00 2001 From: Guy Carmeli Date: Thu, 27 Jun 2019 15:43:09 +0300 Subject: [PATCH] Add back button to last child in setStackRoot This effectively reverts 96661e3308d7ba43732d945bf505b87db388cdcd and fixes the issue properly. --- .../viewcontrollers/stack/StackController.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/StackController.java b/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/StackController.java index 19e6e8d1dfe..05f5cc28fb9 100644 --- a/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/StackController.java +++ b/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/StackController.java @@ -194,11 +194,12 @@ public void onSuccess(String childId) { } }); } else { + backButtonHelper.addToPushedChild(last(children)); push(last(children), new CommandListenerAdapter() { @Override public void onSuccess(String childId) { destroyStack(stackToDestroy); - for (int i = 0; i < children.size(); i++) { + for (int i = 0; i < children.size() - 1; i++) { stack.set(children.get(i).getId(), children.get(i), i); children.get(i).setParentController(StackController.this); if (i == 0) {