diff --git a/.changeset/purple-beers-laugh.md b/.changeset/purple-beers-laugh.md new file mode 100644 index 00000000..43cd13e8 --- /dev/null +++ b/.changeset/purple-beers-laugh.md @@ -0,0 +1,5 @@ +--- +'react-native-bottom-tabs': patch +--- + +fix: prevent header showing on iPad when using a custom one diff --git a/packages/react-native-bottom-tabs/ios/TabViewImpl.swift b/packages/react-native-bottom-tabs/ios/TabViewImpl.swift index bde50485..c64dee52 100644 --- a/packages/react-native-bottom-tabs/ios/TabViewImpl.swift +++ b/packages/react-native-bottom-tabs/ios/TabViewImpl.swift @@ -101,6 +101,7 @@ struct TabViewImpl: View { } .tag(tabData?.key) .tabBadge(tabData?.badge) + .hideTabBar(props.tabBarHidden) .onAppear { #if !os(macOS) updateTabBarAppearance(props: props, tabBar: tabBar) @@ -351,6 +352,20 @@ extension View { self } } + + @ViewBuilder + func hideTabBar(_ flag: Bool) -> some View { + if flag { + if #available(iOS 16.0, *) { + self.toolbar(.hidden, for: .tabBar) + } else { + // We fallback to isHidden on UITabBar + self + } + } else { + self + } + } // Allows TabView to use unfilled SFSymbols. // By default they are always filled.