[Android] Content doesn't resize when tab bar visibility changes (tabBarHidden)
Mantenedores costumam responder em até 1 dia
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Facilidade para iniciantes
- 35/100
Direção de pesquisa
Comece lendo android/src/main/java/com/th3rdwave/safeareacontext/RCTTabView.kt e reproduza o exemplo Android fornecido alternando tabBarHidden. Está concluído quando o conteúdo React e a view ancorada na parte inferior são redimensionados para toda a altura disponível quando a barra de abas está oculta e retornam corretamente quando ela é exibida.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Before submitting a new issue
- I tested using the latest version of the library, as the bug might be already fixed.
- I tested using a supported version of react native.
- I checked for possible duplicate issues, with possible answers.
Bug summary
On Android, when tabBarHidden is toggled to true, the native bottom navigation view is set to GONE and its space is reclaimed at the native level, but the React content does not grow to fill it. The screen keeps its old height, leaving a blank strip at the bottom exactly the height of the tab bar. Bottom-anchored elements (position: 'absolute', bottom: 0) end up floating ~80dp above the actual bottom of the screen. Toggling back to visible has the same problem in reverse until something else triggers a relayout.
I tracked it down to the layout listener in RCTTabView.kt. The size-change guard compares the bounds of the whole container (ReactBottomNavigationView), but when only the tab bar visibility changes, the container keeps the exact same size — only the inner layoutHolder grows or shrinks:
post {
addOnLayoutChangeListener { _, left, top, right, bottom, _, _, _, _ ->
val newWidth = right - left // container size — unchanged when tab bar is hidden
val newHeight = bottom - top
onTabBarMeasuredListener?.invoke(...)
if (newWidth != lastReportedSize?.width || newHeight != lastReportedSize?.height) {
// never reached in this case, so onNativeLayoutListener doesn't fire
onNativeLayoutListener?.invoke(dpWidth, dpHeight)
lastReportedSize = Size(newWidth, newHeight)
}
}
}
Two problems compound here:
- The guard compares the container size, while the value actually reported to JS is the
layoutHoldersize. When the tab bar is hidden, the container stays the same butlayoutHolderchanges, so the guard filters the update out. - The listener is attached to the container, and
OnLayoutChangeListeneronly fires when that view's own bounds change — which they don't in this scenario. So even the callback itself may not run.
As a result onNativeLayout never reaches the JS side, setMeasuredDimensions keeps the stale height, and the children rendered by TabView stay at the old size.
Verified on an emulator with uiautomator dump: after hiding the tab bar, the native layoutHolder grows to full screen height (2400px on my device), while the React subtree inside it stays at the previous 2126px.
iOS is not affected.
Library version
1.4.0
Environment info
System:
OS: macOS 26.5.2
CPU: (18) arm64 Apple M5 Pro
Binaries:
Node: 24.13.0
Yarn: 3.6.4
npm: 11.6.2
npmPackages:
react: 19.2.3
react-native: 0.86.0
Android:
hermesEnabled: true
newArchEnabled: true
iOS:
hermesEnabled: true
newArchEnabled: true
Steps to reproduce
- Android app using
createNativeBottomTabNavigator(New Architecture). - Render a screen with a bottom-anchored view, e.g. an action bar with
position: 'absolute', bottom: 0. - Toggle
tabBarHiddentotrue(typical case: entering a selection/edit mode). - The tab bar disappears, but the bottom-anchored view stays where the tab bar's top edge used to be, with an empty strip below it.
Tested on an Android 16 emulator (arm64), RN 0.86, and reproduced consistently.
Reproducible sample code
const [hidden, setHidden] = useState(false);
<TabView tabBarHidden={hidden} ...>
{/* screen content */}
<View style={{ position: 'absolute', bottom: 0, left: 0, right: 0, height: 56 }}>
<Button title="toggle" onPress={() => setHidden(v => !v)} />
</View>
</TabView>
I have a fix working locally (report the layoutHolder size instead, and also listen to layoutHolder layout changes so the visibility-toggle case is caught). Will open a PR.
- Linguagem predominante
- TypeScript
- Estrelas
- 1.5k
- Forks
- 111
- Merge médio
- 1d 18h
- PRs com merge (30d)
- 7
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de callstack/react-native-bottom-tabs
-
bug
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 92/100
callstack/react-native-bottom-tabs#607 ·
Mantenedores costumam responder em até 1 dia
-
[iOS] Fabric: SIGABRT on tab press when tab key contains non-ASCII characters (kCFStringEncodingUTF8 passed to -cStringUsingEncoding:)Talvez já em andamento @thiagobrez assumiu há 65 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
callstack/react-native-bottom-tabs#560 ·
Mantenedores costumam responder em até 1 dia
-
[iOS] Tabs don't fire tabLongPress event on iOS 26Talvez já em andamento @thiagobrez assumiu há 39 dias. Abertabug
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 48/100
callstack/react-native-bottom-tabs#573 ·
Mantenedores costumam responder em até 1 dia
-
iOS: allow opting out of the private-CoreSVG SVG decoder (exclude_files by default, or an opt-in flag)Talvez já em andamento @oleksandrzavarzin-callstack assumiu há 7 dias. Aberta
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 68/100
callstack/react-native-bottom-tabs#565 ·
Mantenedores costumam responder em até 1 dia
-
Tab icon size is hard-coded to 27x27pt with no way to override itTalvez já em andamento @teddyxfire1992 assumiu há 3 dias. Aberta
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 48/100
callstack/react-native-bottom-tabs#561 · 1 comentário · 2 reações ·
Mantenedores costumam responder em até 1 dia
Todas as issues de callstack/react-native-bottom-tabs
Issues semelhantes
-
area:desktop area:ui bug platform:macos
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 67/100
anthropics/claude-code#106183 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 1/5 1-3 horas Facilidade para iniciantes 76/100
Mantenedores costumam responder em até 1 dia
-
feature:App-Tour feature:Chat ready Web
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 62/100
digitalfabrik/integreat-app#4523 · 2 reações ·
Mantenedores costumam responder em até 3 dias
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
Mantenedores costumam responder em até 1 dia
-
Required Lexical field accepts two empty paragraphsTalvez já em andamento @lazerg assumiu hoje. AbertaBug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
payloadcms/payload#19222 ·
Mantenedores costumam responder em até 1 dia