bug with @react-navigation/bottom-tabs - initial jumping and flickering
See original GitHub issueDescription
When I’m using @react-navigation/bottom-tabs
with the native stack navigator, the header jumps on android and sometimes flickers on iOS on tab change (on the first render only). But it doesn’t happen if I use the JS stack navigator.
I wrapped NavigationContainer
with SafeAreaProvider
like this:
<SafeAreaProvider initialMetrics={initialWindowMetrics}>
<NavigationContainer>
<RootStack />
</NavigationContainer>
</SafeAreaProvider>
I also patched react-navigation bottoms tabs with this PR applied by @WoLewicki react-navigation/react-navigation#9772
If I remove initialWindowMetrics
jump on Android is gone, but on iOS, the header is still flickering.
it maybe related to this issue
Screenshots
Steps To Reproduce
- Open app.
- Click on Tab2.
- See the position of the header.
Expected behavior
the header should not jump on android and flicker on iOS(on initial render).
Actual behavior
on initial render, header jumps on Android and flickers on iOS
Reproduction
reproduction repo:
https://github.com/IvanIhnatsiuk/native-stack-bottom-jump
Platform
- iOS
- Android
- Web
- Windows
- tvOS
Workflow
- Managed workflow
- Bare workflow
Package versions
package | version |
---|---|
react-native | 0.66.4 |
@react-navigation/native | 6.0.9 |
@react-navigation/native-stack | 6.2.5 |
react-native-screens | 3.10.2 |
react-native-safe-area-context | 3.3.2 |
react-native-gesture-handler | 2.2.0 |
react-native-reanimated | 2.3.1 |
@react-navigation/bottom-tabs | 6.0.9 |
Issue Analytics
- State:
- Created 2 years ago
- Reactions:8
- Comments:24 (3 by maintainers)
@WoLewicki I also experience the iOS flicker when navigating for the first time into a tab. I can tell that:
3.3.0
. In3.3.0
, it worksI can also confirm this issue happens after this PR https://github.com/software-mansion/react-native-screens/pull/986.
@ferrannp I am getting flickering when my tab navigator is nested within a stack navigator as well, and for me it only happens when the component rerenders very shortly after the component initially mounts. If no rerender happens quickly the problem does not occur
Reverted to
3.3.0
as you said, and it fixed the issue.Is anyone working on this? Or should I just assume I need to default to version
3.3.0
moving forward to avoid this sort of thing?