-
Notifications
You must be signed in to change notification settings - Fork 424
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
[Material Top Tabs] The tab bar UI doesn't update when navigate to a tab of the navigator from an external screen #872
Comments
@vicprz could you check and confirm, if it is the same issue react-navigation/react-navigation#10932 ? |
No, it's not the same issue 😉 In react-navigation/react-navigation#10932, there are two problems, that only occur on iOS:
In my issue, the problem occurs on both iOS and Android:
|
Thank you for the explanation 🙏 |
i will be looking into that |
Thanks 🥳 |
After running command Screen.Recording.2024-12-12.at.21.44.00.mov |
This issue is a duplicate of an issue opened on React Navigation repo, but a contributor suggests me to also post an issue on this repo as
react-native-pager-view
is a dependency of@react-navigation/material-top-tabs
and the issue seems related toreact-native-pager-view
.Thanks for your help 🙂
Environment
Platform
Packages
✅ I've removed the packages that I don't use
Description
Current behavior
Context
My application has a bottom bar, managed by
@react-navigation/bottom-tabs
, which manages two screens:@react-navigation/material-top-tabs
that also manages two screens (text only):Problem
✅ If I navigate to Replays by tapping on Videos in the bottom tab and then on Replays in the material top tabs, everything works correctly.
🔴 If I navigate to Replays by clicking on the "Go to replays" Home screen button (and whose
onPress
isnavigate(‘Videos’, {screen: ‘Replays’})
), it navigates to the replays screen, but the TabBarIndicator isn't in the right position (it stays below Shorts instead of below Replays) and the bold title is Shorts and not Replays. What's more, the bug is random and occurs 1 time out of 2.Yet, if i tap on Shorts, I navigate to the Shorts screen: I think that the state of the navigation is correctly managed, and that the problem is related to the animation of the material top tab, but maybe I'm wrong 😅.
A video is linked below to help you to better visualise my problem.
I've also realised that if, when I launch my app, I first go to the Videos tab, go back to Home and click on my button, I don't get a bug. The bug only occurs when I click on the Home button without having first clicked on the Videos tab.
What I've tried
I generated a reproducible minimal example, by creating a new React Native app.
The code for my minimal example is available on a Snack linked below.
The bug occurs on iOS on the Snack, but it occurs with both iOS and Android when I use my own simulators. With Snack, I have something weird with Android (touching the "Go to Replays" button goes to Shorts Screens sometimes 😅)
Simulator.Screen.Recording.-.iPhone.15.Pro.Max.-.2024-08-27.at.15.34.24.mp4
Expected behavior
When I tap the "Go to Replays" button of the Home Page, the tab bar indicator is under the "Replays" title, and this title is bold.
Reproducible Demo
https://snack.expo.dev/@victorpe/bug-top-tab?platform=ios
The text was updated successfully, but these errors were encountered: