Repository navigation
fix(ios): keep tab identity when toggling tabBarHidden - #604
Merged
thiagobrez merged 2 commits intoOct 22, 2026
Merged
Conversation
hideTabBar branched on the flag inside a @ViewBuilder, so toggling tabBarHidden swapped _ConditionalContent cases and changed the view's structural identity. SwiftUI rebuilt the tab content, which dismissed sheets presented from the tab and dropped text input focus. Branch on availability only and pass the flag as the toolbar visibility value. Fixes callstack#593
3 tasks done
thiagobrez
reviewed
Oct 22, 2026
thiagobrez
approved these changes
Oct 22, 2026
3 tasks done
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.
PR Description
Closes #593.
The fix was proposed by @pawarren in the issue; this PR applies it and adds a changeset.
hideTabBaris a@ViewBuilderthat branched onflag, so togglingtabBarHiddenswapped the_ConditionalContentcase and changed the view's structural identity. SwiftUI then rebuilt the tab content, which dismissed sheets presented from inside the tab and dropped text input focus. A common trigger is hiding the tab bar while the keyboard is up: focusing a field raises the keyboard, the app hides the tab bar, and the field loses focus and the sheet is dismissed.This branches only on
#available, which is constant at runtime, and passes the flag as the value:.toolbar(flag ? .hidden : .automatic, for: .tabBar)..automaticis the default visibility, so the visible tab bar behaves as before. The pre-iOS 16 fallback is unchanged.On iOS 18+ (
NewTabView) the modifier wraps each tab's content. On older iOS (LegacyTabView) it wraps the wholeTabView, so the fix covers both.How to test?
react-native-bottom-tabsand@expo/ui. In a tab, render aBottomSheetcontaining aTextField.onDismissfires (2–3 times) before it is presented again.onDismissdoes not fire, and the tab bar hides while the keyboard is up.The same issue shows without a sheet: a plain
TextInputin a tab loses focus as soon as the keyboard hides the tab bar.Verified with agent-device in a fresh Expo SDK 57 app (React Native 0.86.3,
@expo/ui57.0.26,react-native-bottom-tabs1.5.0 patched in place), plus the example app's Tab Bar Hidden screen with aTextInput.Recordings
iOS 26 before
before-ios26.mov
iOS 26 after
after-ios26.mov
iOS 17 before
before-ios17.mov
iOS 17 after
after-ios17.mov