Skip to content

Commit

Permalink
Emit bottom tab events on back navigation on Android
Browse files Browse the repository at this point in the history
  • Loading branch information
Roland Egiazaryan committed Jun 21, 2024
1 parent 6439f68 commit 97ad0fb
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -164,15 +164,18 @@ public boolean handleBack(CommandListener listener) {
final boolean childBack = !tabs.isEmpty() && tabs.get(bottomTabs.getCurrentItem()).handleBack(listener);
final Options options = resolveCurrentOptions();
if (!childBack) {
final int oldTabIndex = bottomTabs.getCurrentItem();
if (options.hardwareBack.getBottomTabOnPress() instanceof HwBackBottomTabsBehaviour.PrevSelection) {
if (!selectionStack.isEmpty()) {
final int prevSelectedTabIndex = selectionStack.poll();
selectTab(prevSelectedTabIndex, false);
eventEmitter.emitBottomTabSelected(oldTabIndex, prevSelectedTabIndex);
return true;
}
} else if (options.hardwareBack.getBottomTabOnPress() instanceof HwBackBottomTabsBehaviour.JumpToFirst) {
if (getSelectedIndex() != 0) {
selectTab(0, false);
eventEmitter.emitBottomTabSelected(oldTabIndex, 0);
return true;
} else {
return false;
Expand Down

0 comments on commit 97ad0fb

Please sign in to comment.