fix(TabView): respect user-supplied tabBarHidden#524
Draft
spokodev wants to merge 1 commit into
Draft
Conversation
The native side wired tabBarHidden into the SwiftUI tab bar via callstack#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 callstack#521
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #521.
tabBarHiddenis wired natively (SwiftUI.hideTabBar(props.tabBarHidden), landed in #76) but the JS wrapper inpackages/react-native-bottom-tabs/src/TabView.tsxhardcodedtabBarHidden={!!renderCustomTabBar}after the{...props}spread, so any caller-supplied value was overwritten before it reachedNativeTabView. The prop was also absent from theProps<Route>interface so it never surfaced at the type level either.This PR:
tabBarHidden?: booleanto theTabViewProps<Route>interface with a JSDoc note that explains the default and the iOS 26+ use case from the issue!!renderCustomTabBarbehavior as the fallback when the caller does not pass a value (tabBarHidden ?? !!renderCustomTabBar)Effect:
<TabView ... tabBarHidden={true} />to hide the native bar without rendering a customtabBar, which is what the issue needs on iOS 26 where theUITabBar.isHiddenworkarounds from outside React Native no longer reach the SwiftUI-backed bartabBarHiddenget the same behavior as before (hidden ifftabBaris provided)Verification:
tsc -bclean on the packageeslint packages/react-native-bottom-tabs/src/TabView.tsxreports only the pre-existingno-shadowwarning onloaded(line 293), unrelated to this changeit.todo('write a test')andyarn testfails onmaindue to Flow type syntax inreact-native/jest/setup.js, so a behavioural test would require fixing the jest config first which is outside the scope of this PR.changeset/respect-user-tab-bar-hidden.md(react-native-bottom-tabs: patch)Out of scope:
@bottom-tabs/react-navigation) does not referencetabBarHidden, so the<Tabs.Navigator tabBarHidden={shouldHide}>mention in the issue would need a separate change in that package's screen-options forwarding