Skip to content
This repository has been archived by the owner on Nov 27, 2022. It is now read-only.

Tab bar does not show correct tab after being unmounted and remounted #1234

Open
1 of 5 tasks
saty9 opened this issue Jul 30, 2021 · 8 comments
Open
1 of 5 tasks

Tab bar does not show correct tab after being unmounted and remounted #1234

saty9 opened this issue Jul 30, 2021 · 8 comments

Comments

@saty9
Copy link

saty9 commented Jul 30, 2021

Current behavior

tabbug_converted.mov

If you return a null in renderTabBar and then later start returning the tab bar component again it renders with the wrong tab selected

Expected behavior

The tab bar should always render with the correct tab selected

Reproduction

https://github.com/saty9/react-native-tab-view-issue-reproduction

Platform

  • Android
  • iOS
  • Web
  • Windows
  • MacOS

Environment

package version
react-native-tab-view 3.0.1
react-native-pager-view 5.4.0
react-native 0.64.2
expo N/A
node 16.2.0
npm or yarn 1.22.10
@saty9 saty9 added the bug label Jul 30, 2021
@github-actions
Copy link

Couldn't find version numbers for the following packages in the issue:

  • expo

Can you update the issue to include version numbers for those packages? The version numbers must match the format 1.2.3.

@github-actions
Copy link

Hey! Thanks for opening the issue. The issue doesn't seem to contain a link to a repro (a snack.expo.dev link or link to a GitHub repo under your username).

Can you provide a minimal repro which demonstrates the issue? A repro will help us debug the issue faster. Please try to keep the repro as small as possible and make sure that we can run it without additional setup.

@saty9
Copy link
Author

saty9 commented Jul 30, 2021

Hey! Thanks for opening the issue. The issue doesn't seem to contain a link to a repro (a snack.expo.dev link or link to a GitHub repo under your username).

Can you provide a minimal repro which demonstrates the issue? A repro will help us debug the issue faster. Please try to keep the repro as small as possible and make sure that we can run it without additional setup.

would be good to allow org repos as well as personal ones

@the-habu
Copy link

Having the same problem. I am using the tab view in a modal. When re-opening the modal, the initial index is wrong (not always, but often).

@Shahulul
Copy link

Shahulul commented Nov 4, 2021

facing a similar issue only on android. Any solution
material top bar issue#10101

@likeSo
Copy link

likeSo commented Nov 9, 2021

Same problem here

@karel-suchomel-ed
Copy link

Facing the same issue. After changing to a different tab e.g. index 3, unmounting, and resetting navigationState index back to 0, the newly mounted Tabbar displays the tab on index 3 as selected rather than 0.

@karel-suchomel-ed
Copy link

Facing the same issue. After changing to a different tab e.g. index 3, unmounting, and resetting navigationState index back to 0, the newly mounted Tabbar displays the tab on index 3 as selected rather than 0.

When I unmounted the TabBar I originally rendered a SkeletonPlaceholder instead of it and that seems to be the problem.
The workaround that is not really pretty but works for me is after unmounting the original TabBar, I render another TabBar with altered navigationState and styles that make it look like a placeholder on the screen.

I have a CustomTabBar component, which I pass to renderTabBar in TabView, and in that component a conditionally swap the 2 TabBars and it seems to work.

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

No branches or pull requests

5 participants