Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/tall-mails-refuse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"react-native-bottom-tabs": patch
---

Fix Android tab screens staying clipped at a transient startup height for the whole session. The onNativeLayout change-guard compared the outer view's size while reporting the inner layoutHolder's size, so a height caught mid-layout during startup was never re-reported. The guard is now keyed on layoutHolder itself, so a later correct layout re-reports and the view self-heals.
Original file line number Diff line number Diff line change
Expand Up @@ -100,17 +100,23 @@ class ReactBottomNavigationView(context: Context) : LinearLayout(context) {
uiModeConfiguration = resources.configuration.uiMode

post {
addOnLayoutChangeListener { _, left, top, right, bottom,
addOnLayoutChangeListener { _, _, _, _, _,
_, _, _, _ ->
val newWidth = right - left
val newHeight = bottom - top
// Key the change-guard on the same view we report (layoutHolder), not
// on this outer view: during startup the outer frame can settle while
// layoutHolder is still mid-layout, so guarding on the outer size
// latches a transient layoutHolder height for the whole session (tab
// content clipped, dead space below). Guarding on layoutHolder itself
// means any later correct layout re-reports and the view self-heals.
val newWidth = layoutHolder.width
val newHeight = layoutHolder.height

// Notify about tab bar height.
onTabBarMeasuredListener?.invoke(Utils.convertPixelsToDp(context, bottomNavigation.height).toInt())

if (newWidth != lastReportedSize?.width || newHeight != lastReportedSize?.height) {
val dpWidth = Utils.convertPixelsToDp(context, layoutHolder.width)
val dpHeight = Utils.convertPixelsToDp(context, layoutHolder.height)
val dpWidth = Utils.convertPixelsToDp(context, newWidth)
val dpHeight = Utils.convertPixelsToDp(context, newHeight)

onNativeLayoutListener?.invoke(dpWidth, dpHeight)
lastReportedSize = Size(newWidth, newHeight)
Expand Down