Skip to content

Commit 5ae769e

Browse files
committed
fix(ios): prevent header showing on iPad when using a custom one
1 parent 93afe39 commit 5ae769e

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

.changeset/purple-beers-laugh.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'react-native-bottom-tabs': patch
3+
---
4+
5+
fix: prevent header showing on iPad when using a custom one

packages/react-native-bottom-tabs/ios/TabViewImpl.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ struct TabViewImpl: View {
101101
}
102102
.tag(tabData?.key)
103103
.tabBadge(tabData?.badge)
104+
.hideTabBar(props.tabBarHidden)
104105
.onAppear {
105106
#if !os(macOS)
106107
updateTabBarAppearance(props: props, tabBar: tabBar)
@@ -351,6 +352,20 @@ extension View {
351352
self
352353
}
353354
}
355+
356+
@ViewBuilder
357+
func hideTabBar(_ flag: Bool) -> some View {
358+
if flag {
359+
if #available(iOS 16.0, *) {
360+
self.toolbar(.hidden, for: .tabBar)
361+
} else {
362+
// We fallback to isHidden on UITabBar
363+
self
364+
}
365+
} else {
366+
self
367+
}
368+
}
354369

355370
// Allows TabView to use unfilled SFSymbols.
356371
// By default they are always filled.

0 commit comments

Comments
 (0)