fix: report content size to JS when tab bar visibility changes on Android#558
Open
JJalit wants to merge 1 commit into
Open
fix: report content size to JS when tab bar visibility changes on Android#558JJalit wants to merge 1 commit into
JJalit wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Description
Fixes #557
Bug fix. On Android, toggling
tabBarHiddendidn't resize the React content. The layout listener's size-change guard compares the bounds of the wholeReactBottomNavigationViewcontainer, but hiding/showing the tab bar doesn't change the container bounds — only the innerlayoutHoldergrows or shrinks. On top of that, the listener is attached to the container, soOnLayoutChangeListenerdoesn't even fire in that case. As a resultonNativeLayoutListenernever reported the new size,setMeasuredDimensionson the JS side kept the stale height, and the content stayed short with a blank strip where the tab bar used to be.Changes:
layoutHoldersize (which is what was already being sent to JS anyway) instead of the container size, extracted intoreportLayoutHolderSizeIfChanged().layoutHolderlayout changes, so the visibility-toggle case (container bounds unchanged) is caught.How to test?
createNativeBottomTabNavigator, render a screen with a bottom-anchored view (position: 'absolute', bottom: 0).tabBarHiddentotrue.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 nativelayoutHoldergrew to 2400px after hiding the tab bar; with this change both match, in both directions.Screenshots
N/A — measurement/layout change, behavior described above.