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

[V7] React Native Tab View: Tab Label Status Incorrect When Switching Tabs on Android Device #12282

Closed
2 of 11 tasks
hapo-nghialuu opened this issue Nov 21, 2024 · 10 comments
Closed
2 of 11 tasks

Comments

@hapo-nghialuu
Copy link

hapo-nghialuu commented Nov 21, 2024

XRecorder_21112024_163152.mp4

Current behavior

I'm encountering an issue on Android devices where the tab label status is incorrect when switching between tabs.

This issue appeared after upgrading to Expo 52, along with the latest versions of @react-navigation/native (^7.0.0) and react-native-tab-view (^4.0.2).

The problem did not occur with Expo version 51, @react-navigation/native (^6.0.2), and react-native-tab-view (^3.5.2).

Please refer to the video for a demonstration of the issue.

Expected behavior

Tab label status show correctly with Expo 52

Reproduction

Private

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
package version
@react-navigation/native ^7.0.0
react-native-screens ^4.0.0
react-native-gesture-handler ~2.20.2
react-native-tab-view ^4.0.2
react-native-pager-view 6.5.1
react-native 0.76.2
expo ^52.0.8
Copy link

Hey @hapo-nghialuu! 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.

Copy link

The versions mentioned in the issue for the following packages differ from the latest versions on npm:

  • @react-navigation/native (found: 7.0.0, latest: 7.0.3)

Can you verify that the issue still exists after upgrading to the latest versions of these packages?

Copy link

Hey! Thanks for opening the issue. Seems that this issue is related to react-native-pager-view library which is a dependency of Material Top Tabs. Can you also post your issue in this repo so that it's notified to the maintainers of that library? This will help us fix the issue faster since it's upto the maintainers of that library to investigate it.

@hapo-nghialuu
Copy link
Author

The versions mentioned in the issue for the following packages differ from the latest versions on npm:

  • @react-navigation/native (found: 7.0.0, latest: 7.0.3)

Can you verify that the issue still exists after upgrading to the latest versions of these packages?

I upgraded @react-navigation/native to 7.0.3, but this issue still is encountered

@hapo-nghialuu
Copy link
Author

const renderTabBar = (props: any) => {
  return (
    <TabBar
      {...props}
      indicatorStyle={{ backgroundColor: 'blue' }}
      style={{
        backgroundColor: 'white',
      }}
      activeColor="blue"
      inactiveColor="gray"
      scrollEnabled={true}
      tabStyle={{ width: 100 }}
    />
  );
};

<TabView
          lazy
          navigationState={{ index, routes }}
          renderScene={renderScene}
          onIndexChange={setIndex}
          renderTabBar={renderTabBar}
          initialLayout={{
            width: layout.width,
          }}
        />

I realize that the issue occurs when using renderTabBar, otherwise, it doesn't happen.

@hapo-nghialuu
Copy link
Author

const renderTabBar = (props: any) => {
  return (
    <TabBar
      {...props}
      indicatorStyle={{ backgroundColor: 'blue' }}
      style={{
        backgroundColor: 'white',
      }}
      activeColor="blue"
      inactiveColor="gray"
      scrollEnabled={true}
      tabStyle={{ width: 100 }}
    />
  );
};

<TabView
          lazy
          navigationState={{ index, routes }}
          renderScene={renderScene}
          onIndexChange={setIndex}
          renderTabBar={renderTabBar}
          initialLayout={{
            width: layout.width,
          }}
        />

I realize that the issue occurs when using renderTabBar, otherwise, it doesn't happen.

It seems that tabStyle={{ width: 100 }} is causing the bug

@usama78621
Copy link

same i am facing this issue on android

@poypoy252525
Copy link

did you find any solution?

@hapo-manhnd
Copy link

did you find any solution?

I think reason is after upgrading to Expo 52 so I downgraded expo 51

Copy link

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.

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

5 participants