Skip to content

bottom tab tap don't pop to root on android #6981

@ludwig-pro

Description

@ludwig-pro

🐛 Bug Report

iOS and Android don't have the same behavior when you navigate inside a stack with bottom tabs and tap the active tab.

Have you read the Contributing Guidelines on issues?

yep !

To Reproduce

  1. navigate inside a sub screen of a stack ( so have 2 screens inside the stack, the root and a second one)
  2. tap on the current active tab

Expected behavior

When you are inside a stack, I expect the tap on active bottom tab to popToRoot()

Actual Behavior

when you are inside a stack, and tap on active bottom tab

  • ✅ on iOS it's worked, popToRoot()
  • ❌on android... nothing append

**ANDROID**
20210219_210325.mp4

**IOS**
RPReplay_Final1613820856.MP4

Your Environment

 "dependencies": {
    "react": "16.13.1",
    "react-native": "0.63.4",
    "react-native-navigation": "^7.10.0"
  },
  • Platform: Android
  • Device info: tested on physical device, debug & release

Reproducible Demo

https://github.com/ludwig-pro/react-native-navigation-debug

  1. Tap on the setting tab
  2. Tap on the button "push new settings screen"
  3. Tap on the current tab - Settings

i have found a workaround by listening event

  React.useEffect(() => {
    const listener = async (event) => {
      await Navigation.popToRoot('THE_HOME');
    };
    const unsubscribe = Navigation.events().registerBottomTabSelectedListener(
      listener,
    );
    return () => {
      unsubscribe.remove();
    };
  }, []);

you can test it on the home stack:

  1. Tap on the Home tab
  2. Tap on the button "push new screen"
  3. Tap on the current tab - Home -> it's pop to root :)

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions