From 462f613da049368720860674b5f181bfafe7694d Mon Sep 17 00:00:00 2001 From: Yarchik Date: Fri, 29 May 2026 23:54:04 +0100 Subject: [PATCH] fix(TabView): respect user-supplied tabBarHidden The native side wired tabBarHidden into the SwiftUI tab bar via #76, but the JS wrapper hardcoded tabBarHidden={!!renderCustomTabBar} after the {...props} spread, so any value the caller passed was overwritten before it reached NativeTabView. The prop was also absent from the TabView Props interface so it never type-checked at all. Add tabBarHidden to Props, destructure it explicitly, and keep the renderCustomTabBar default only as a fallback when the caller does not supply a value. Closes #521 --- .changeset/respect-user-tab-bar-hidden.md | 5 +++++ packages/react-native-bottom-tabs/src/TabView.tsx | 11 ++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 .changeset/respect-user-tab-bar-hidden.md diff --git a/.changeset/respect-user-tab-bar-hidden.md b/.changeset/respect-user-tab-bar-hidden.md new file mode 100644 index 0000000..e20781f --- /dev/null +++ b/.changeset/respect-user-tab-bar-hidden.md @@ -0,0 +1,5 @@ +--- +'react-native-bottom-tabs': patch +--- + +Respect user-supplied `tabBarHidden` on `TabView`. The prop was wired natively but the JS wrapper hardcoded `tabBarHidden={!!renderCustomTabBar}` after the `{...props}` spread, so any user value was silently overwritten. The prop is now declared on the public `TabView` API and only falls back to the custom-tab-bar default when the caller omits it, which lets iOS 26+ users hide the SwiftUI-backed tab bar from JS again. diff --git a/packages/react-native-bottom-tabs/src/TabView.tsx b/packages/react-native-bottom-tabs/src/TabView.tsx index 4e93f09..c968add 100644 --- a/packages/react-native-bottom-tabs/src/TabView.tsx +++ b/packages/react-native-bottom-tabs/src/TabView.tsx @@ -212,6 +212,14 @@ interface Props { * @default 'locale' */ layoutDirection?: LayoutDirection; + /** + * Whether to hide the native tab bar. Defaults to `true` when a custom + * `tabBar` is provided (so the native bar does not stack on top of the + * custom one), otherwise `false`. Set explicitly to override the default, + * which is required on iOS 26+ where `UITabBar.isHidden` workarounds from + * outside React Native no longer reach the SwiftUI-backed tab bar. + */ + tabBarHidden?: boolean; } const ANDROID_MAX_TABS = 100; @@ -247,6 +255,7 @@ const TabView = ({ labeled = Platform.OS !== 'android' ? true : undefined, getFreezeOnBlur = ({ route }: { route: Route }) => route.freezeOnBlur, tabBar: renderCustomTabBar, + tabBarHidden, tabBarStyle, tabLabelStyle, renderBottomAccessoryView, @@ -404,7 +413,7 @@ const TabView = ({ // When rendering a custom tab bar, icons can be React elements, which will not be properly resolved. icons={renderCustomTabBar ? undefined : resolvedIconAssets} selectedPage={focusedKey} - tabBarHidden={!!renderCustomTabBar} + tabBarHidden={tabBarHidden ?? !!renderCustomTabBar} onTabLongPress={handleTabLongPress} onPageSelected={handlePageSelected} onTabBarMeasured={handleTabBarMeasured}