Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tabPress no longer a part of the listeners Prop. Cannot override bottom-tabs button press behavior anymore #11363

Closed
4 of 12 tasks
1mike12 opened this issue May 8, 2023 · 6 comments

Comments

@1mike12
Copy link

1mike12 commented May 8, 2023

Current behavior

https://stackoverflow.com/a/62056423/2532762

There is supposed to be a way to override the buttons on the bottom navigator. For instance, to have one of the buttons skip the bottom tap navigation altogether and instead navigate to a new page. This was working around a year ago when I was working with this funcitonality but no longer works.

 <Tab.Screen
            name="log"
            component={() => null}
            options={{
              tabBarIcon: LogButton as any
            }}
            listeners={{
              tabPress: (e) => {
                // Prevent default action
                e.preventDefault()
                this.props.navigation.navigate("foo")
              }
            }}
          />

Expected behavior

should intercept button press and prevent default behavior

Reproduction

none

Platform

  • Android
  • iOS
  • Web
  • Windows
  • MacOS

Packages

  • @react-navigation/bottom-tabs
  • @react-navigation/drawer
  • @react-navigation/material-top-tabs
  • @react-navigation/stack
  • @react-navigation/native-stack
  • react-native-tab-view

Environment

  • I've removed the packages that I don't use
    "@react-navigation/bottom-tabs": "^6.5.7",
    "@react-navigation/native": "^6.1.6",
    "@react-navigation/native-stack": "^6.9.12",
    "@tsconfig/react-native": "^3.0.0",
    "react": "18.2.0",
    "react-native": "0.71.7",
    "react-native-date-picker": "^4.2.13",
    "react-native-device-info": "^10.6.0",
    "react-native-elements": "^3.4.3",
    "react-native-fast-image": "^8.6.3",
    "react-native-image-picker": "^5.3.1",
    "react-native-linear-gradient": "^2.6.2",
    "react-native-localize": "^3.0.0",
    "react-native-pager-view": "^6.2.0",
    "react-native-safe-area-context": "^4.5.2",
    "react-native-screens": "^3.20.0",
    "react-native-svg": "^13.9.0",
    "react-native-tab-view": "^3.5.1",
@1mike12 1mike12 added the bug label May 8, 2023
@github-actions
Copy link

github-actions bot commented May 8, 2023

Hey @1mike12! Thanks for opening the issue. It seems that the issue doesn't contain a link to a repro.

The best way to get attention to your issue is to provide an easy way for a developer to reproduce the issue.

You can provide a repro using any of the following:

A snack link is preferred since it's the easiest way to both create and share a repro. If it's not possible to create a repro using a snack, link to a GitHub repo under your username is a good alternative. Don't link to a branch or specific file etc. as it won't be detected.

Try to keep the repro as small as possible by narrowing down the minimal amount of code needed to reproduce the issue. Don't link to your entire project or a project containing code unrelated to the issue. See "How to create a Minimal, Reproducible Example" for more information.

You can edit your original issue to include a link to the repro, or leave it as a comment. The issue will be closed automatically after a while if you don't provide a repro.

@1mike12
Copy link
Author

1mike12 commented May 8, 2023

couldnt repro in the virtual sandbox, will create a project and update link

@github-actions
Copy link

github-actions bot commented Jun 8, 2023

Hello 👋, this issue has been open for more than a month without a repro or any activity. If the issue is still present in the latest version, please provide a repro or leave a comment within 7 days to keep it open, otherwise it will be closed automatically. If you found a solution or workaround for the issue, please comment here for others to find. If this issue is critical for you, please consider sending a pull request to fix it.

@ian
Copy link

ian commented Oct 22, 2023

Related #10637

@github-actions
Copy link

Hey! This issue is closed and isn't watched by the core team. You are welcome to discuss the issue with others in this thread, but if you think this issue is still valid and needs to be tracked, please open a new issue with a repro.

@murilogok
Copy link

According to official docs the event "tabPress" should exists but we can't find it in any 6x version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants