Skip to content

Commit 462f613

Browse files
committed
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
1 parent f2e12e7 commit 462f613

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

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+
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.

packages/react-native-bottom-tabs/src/TabView.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,14 @@ interface Props<Route extends BaseRoute> {
212212
* @default 'locale'
213213
*/
214214
layoutDirection?: LayoutDirection;
215+
/**
216+
* Whether to hide the native tab bar. Defaults to `true` when a custom
217+
* `tabBar` is provided (so the native bar does not stack on top of the
218+
* custom one), otherwise `false`. Set explicitly to override the default,
219+
* which is required on iOS 26+ where `UITabBar.isHidden` workarounds from
220+
* outside React Native no longer reach the SwiftUI-backed tab bar.
221+
*/
222+
tabBarHidden?: boolean;
215223
}
216224

217225
const ANDROID_MAX_TABS = 100;
@@ -247,6 +255,7 @@ const TabView = <Route extends BaseRoute>({
247255
labeled = Platform.OS !== 'android' ? true : undefined,
248256
getFreezeOnBlur = ({ route }: { route: Route }) => route.freezeOnBlur,
249257
tabBar: renderCustomTabBar,
258+
tabBarHidden,
250259
tabBarStyle,
251260
tabLabelStyle,
252261
renderBottomAccessoryView,
@@ -404,7 +413,7 @@ const TabView = <Route extends BaseRoute>({
404413
// When rendering a custom tab bar, icons can be React elements, which will not be properly resolved.
405414
icons={renderCustomTabBar ? undefined : resolvedIconAssets}
406415
selectedPage={focusedKey}
407-
tabBarHidden={!!renderCustomTabBar}
416+
tabBarHidden={tabBarHidden ?? !!renderCustomTabBar}
408417
onTabLongPress={handleTabLongPress}
409418
onPageSelected={handlePageSelected}
410419
onTabBarMeasured={handleTabBarMeasured}

0 commit comments

Comments
 (0)