Skip to content

fix: report content size to JS when tab bar visibility changes on Android - #558

Open
JJalit wants to merge 1 commit into
callstack:mainfrom
JJalit:fix/android-tab-bar-hidden-content-resize
Open

fix: report content size to JS when tab bar visibility changes on Android#558
JJalit wants to merge 1 commit into
callstack:mainfrom
JJalit:fix/android-tab-bar-hidden-content-resize

Conversation

@JJalit

@JJalit JJalit commented Jul 23, 2026

Copy link
Copy Markdown

PR Description

Fixes #557

Bug fix. On Android, toggling tabBarHidden didn't resize the React content. The layout listener's size-change guard compares the bounds of the whole ReactBottomNavigationView container, but hiding/showing the tab bar doesn't change the container bounds — only the inner layoutHolder grows or shrinks. On top of that, the listener is attached to the container, so OnLayoutChangeListener doesn't even fire in that case. As a result onNativeLayoutListener never reported the new size, setMeasuredDimensions on the JS side kept the stale height, and the content stayed short with a blank strip where the tab bar used to be.

Changes:

  • Compare and report the layoutHolder size (which is what was already being sent to JS anyway) instead of the container size, extracted into reportLayoutHolderSizeIfChanged().
  • Also observe layoutHolder layout changes, so the visibility-toggle case (container bounds unchanged) is caught.

How to test?

  1. In an Android app using createNativeBottomTabNavigator, render a screen with a bottom-anchored view (position: 'absolute', bottom: 0).
  2. Toggle tabBarHidden to true.
  3. Before this change: the bottom-anchored view stays at the tab bar's old top edge, with an empty strip below it. After: the content fills the reclaimed space and the view sits at the actual bottom of the screen.
  4. Toggle back to false — the content shrinks back above the tab bar.

Verified on an Android 16 emulator (RN 0.86, New Architecture) with uiautomator dump: previously the React subtree stayed at 2126px while the native layoutHolder grew to 2400px after hiding the tab bar; with this change both match, in both directions.

Screenshots

N/A — measurement/layout change, behavior described above.

@markrickert

Copy link
Copy Markdown

👍
Thank you for this PR! I can confirm that this fixed my issue on Android when swapping the tabBarHidden value back and forth!

I've applied a patch to my project till this fix ships!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants