From 7c9775663e1ead505216868778bb69c27a528aad Mon Sep 17 00:00:00 2001 From: "alen.vecerin" Date: Thu, 22 Oct 2026 11:10:08 +0200 Subject: [PATCH 1/2] fix(ios): keep tab identity when toggling tabBarHidden 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 #593 --- .changeset/hide-tab-bar-identity.md | 5 +++++ .../react-native-bottom-tabs/ios/TabViewImpl.swift | 13 ++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) create mode 100644 .changeset/hide-tab-bar-identity.md diff --git a/.changeset/hide-tab-bar-identity.md b/.changeset/hide-tab-bar-identity.md new file mode 100644 index 00000000..edc7e65e --- /dev/null +++ b/.changeset/hide-tab-bar-identity.md @@ -0,0 +1,5 @@ +--- +'react-native-bottom-tabs': patch +--- + +Fix toggling `tabBarHidden` on iOS rebuilding the tab content, which dismissed sheets presented from the tab and dropped text input focus diff --git a/packages/react-native-bottom-tabs/ios/TabViewImpl.swift b/packages/react-native-bottom-tabs/ios/TabViewImpl.swift index 6de510d0..6debb45e 100644 --- a/packages/react-native-bottom-tabs/ios/TabViewImpl.swift +++ b/packages/react-native-bottom-tabs/ios/TabViewImpl.swift @@ -660,14 +660,13 @@ extension View { @ViewBuilder func hideTabBar(_ flag: Bool) -> some View { #if !os(macOS) - if flag { - if #available(iOS 16.0, tvOS 16.0, *) { - self.toolbar(.hidden, for: .tabBar) - } else { - // We fallback to isHidden on UITabBar - self - } + if #available(iOS 16.0, tvOS 16.0, *) { + // Branch only on availability so toggling `flag` keeps the tab content's + // SwiftUI identity. Branching on `flag` swaps `_ConditionalContent` cases, + // which rebuilds the subtree and drops focus and anchored presentations. + self.toolbar(flag ? .hidden : .automatic, for: .tabBar) } else { + // We fallback to isHidden on UITabBar self } #else From 1035f2368d94852f3eea730e6e61cfa3d0333b40 Mon Sep 17 00:00:00 2001 From: "alen.vecerin" Date: Thu, 22 Oct 2026 11:51:46 +0200 Subject: [PATCH 2/2] refactor(ios): remove comment from hideTabBar --- packages/react-native-bottom-tabs/ios/TabViewImpl.swift | 3 --- 1 file changed, 3 deletions(-) diff --git a/packages/react-native-bottom-tabs/ios/TabViewImpl.swift b/packages/react-native-bottom-tabs/ios/TabViewImpl.swift index 6debb45e..ca8ff60a 100644 --- a/packages/react-native-bottom-tabs/ios/TabViewImpl.swift +++ b/packages/react-native-bottom-tabs/ios/TabViewImpl.swift @@ -661,9 +661,6 @@ extension View { func hideTabBar(_ flag: Bool) -> some View { #if !os(macOS) if #available(iOS 16.0, tvOS 16.0, *) { - // Branch only on availability so toggling `flag` keeps the tab content's - // SwiftUI identity. Branching on `flag` swaps `_ConditionalContent` cases, - // which rebuilds the subtree and drops focus and anchored presentations. self.toolbar(flag ? .hidden : .automatic, for: .tabBar) } else { // We fallback to isHidden on UITabBar