Skip to content

fix(Tabs): remove width/height 100% from TabsHost fillParent style#3663

Open
kimchi-developer wants to merge 1 commit intosoftware-mansion:mainfrom
kimchi-developer:fix/tabs-host-flex-layout
Open

fix(Tabs): remove width/height 100% from TabsHost fillParent style#3663
kimchi-developer wants to merge 1 commit intosoftware-mansion:mainfrom
kimchi-developer:fix/tabs-host-flex-layout

Conversation

@kimchi-developer
Copy link
Contributor

Summary

Closes #3662

  • Remove width: '100%' and height: '100%' from TabsHost's fillParent style
  • Keep only flex: 1, which is sufficient for the native layout constraints on both iOS and Android

Problem

TabsHost cannot be used as a flex child alongside sibling views. The explicit width/height: '100%' forces it to take the full parent size, making patterns like a persistent banner above tabs impossible.

Why this is safe

  • iOS: RNSBottomTabsHostComponentView.mm pins controller.view to the host view's 4 edges via NSLayoutConstraint — it fills whatever bounds the JS view provides
  • Android: TabsHost.kt uses MATCH_PARENT — same behavior, fills the parent view's bounds
  • TabsScreen is not affected — it uses position: 'absolute' (correct for stacking tab content)

Test plan

  • Wrap NativeTabs in a <View style={{ flex: 1 }}> with a sibling <View> above it
  • Verify the sibling renders above and NativeTabs fills remaining space
  • Verify tabs render correctly when used standalone (no siblings) — flex: 1 still fills parent

The fillParent style on TabsHost uses `flex: 1` together with
`width: '100%'` and `height: '100%'`. The explicit width/height
prevents TabsHost from participating in flex layout with sibling
views, because '100%' forces it to take the full parent size
regardless of other flex children.

This makes it impossible to place persistent UI elements (e.g. a
banner ad) alongside NativeTabs in a parent flex container — the
tabs always cover the full screen.

Removing width/height and keeping only `flex: 1` lets the native
component fill the remaining space after siblings, while the native
iOS (NSLayoutConstraint pinning) and Android (MATCH_PARENT) layout
still correctly sizes the tab controller within TabsHost bounds.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TabsHost fillParent style prevents flex layout with sibling views

1 participant

Comments