From 6e6767d4f136d9fe61576ea4509eaffc3a3bfa5c Mon Sep 17 00:00:00 2001 From: Yogev Ben David Date: Thu, 2 Sep 2021 15:58:32 +0300 Subject: [PATCH] Revert "Pop to root when tapping on active bottom tab on Android (#7239)" This reverts commit bb2b09eed05280d83abf1d850a856041c43a6afa. --- .../bottomtabs/BottomTabsController.java | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/bottomtabs/BottomTabsController.java b/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/bottomtabs/BottomTabsController.java index d973e29b7fd..3bfc944a77f 100644 --- a/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/bottomtabs/BottomTabsController.java +++ b/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/bottomtabs/BottomTabsController.java @@ -15,13 +15,11 @@ import com.reactnativenavigation.options.BottomTabOptions; import com.reactnativenavigation.options.Options; import com.reactnativenavigation.react.CommandListener; -import com.reactnativenavigation.react.CommandListenerAdapter; import com.reactnativenavigation.react.events.EventEmitter; import com.reactnativenavigation.utils.ImageLoader; import com.reactnativenavigation.viewcontrollers.bottomtabs.attacher.BottomTabsAttacher; import com.reactnativenavigation.viewcontrollers.child.ChildControllersRegistry; import com.reactnativenavigation.viewcontrollers.parent.ParentController; -import com.reactnativenavigation.viewcontrollers.stack.StackController; import com.reactnativenavigation.viewcontrollers.viewcontroller.Presenter; import com.reactnativenavigation.viewcontrollers.viewcontroller.ViewController; import com.reactnativenavigation.views.bottomtabs.BottomTabs; @@ -171,22 +169,15 @@ public ViewController getCurrentChild() { @Override public boolean onTabSelected(int index, boolean wasSelected) { - ViewController stack = tabs.get(index); - BottomTabOptions options = stack.resolveCurrentOptions().bottomTabOptions; + BottomTabOptions options = tabs.get(index).resolveCurrentOptions().bottomTabOptions; eventEmitter.emitBottomTabPressed(index); if (options.selectTabOnPress.get(true)) { eventEmitter.emitBottomTabSelected(bottomTabs.getCurrentItem(), index); - if (!wasSelected) { - selectTab(index); - } + if (wasSelected) return false; + selectTab(index); } - - if (wasSelected && stack instanceof StackController) { - ((StackController) stack).popToRoot(Options.EMPTY, new CommandListenerAdapter()); - } - return false; }