Skip to content

hardware back button support for bottoms #7348

Closed

Description

@aliraza-noon

🐛 Bug Report

When switching between bottom tabs it does not go back to previously selected tab when i press hardware back button, please check popular apps like

  • youtube
  • facebook
  • twitter

Have you read the Contributing Guidelines on issues?

Yes

To Reproduce

(Write your steps here:)

  1. Setup a demo app with 2 bottoms
  2. Tap on 1st tab first and then switch to 2nd tab
  3. Try pressing hardware back button

Expected behavior

It should take you back to previously selected tab

Actual Behavior

It closes the app when you press the hardware back button

Your Environment

  • React Native Navigation version: 7.23.1
  • React Native version: 0.66.0
  • Platform(s) (iOS, Android, or both?): Android
  • Device info (Simulator/Device? OS version? Debug/Release?): Pixel2 api version 30 debug

Are you willing to resolve this issue by submitting a Pull Request?

  • ✖️   Yes, I have the time, and I know how to start.
  • ✖️   Yes, I have the time, but I don't know how to start. I would need guidance.
  • ✅   No, I don’t have the time and I’m okay to wait for the community / maintainers to resolve this issue.

Activity

  1. phuongwd commented on Nov 18, 2021

    @phuongwd

    I have handled that on my app. Im prefer the behavior "always to the first (default) tab" when press on hardware back button.
    Just checked, the Material Design no longer mentions back button behavior.

    Popular apps back behavior
    Google Photos quit app on back press on any tab
    Youtube, Facebook previously selected tab
    Airbnb, Google+, Play Books pressing back takes you always to the first (default) tab, pressing again closes the app
  2. swabbass commented on Nov 21, 2021

    @swabbass
    Contributor

    This should be converted to a discussion (on the side menu "convert to discussion" as an idea, and maybe you can suggest adding a new option for hardware back like:

    const options = {
      hardwareBackButton:{
        dismissModalOnPress: true, //exists
        popStackOnPress: true, // exists
        bottomTabsBehaviour: 'exit' | 'previous' | 'first', // new
      }
    }
  3. aliraza-noon commented on Nov 22, 2021

    @aliraza-noon
    ContributorAuthor

    @swabbass I don't see the "convert to discussion"

  4. locked and limited conversation to collaborators on Nov 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions