Skip to content

Commit fbe773a

Browse files
committed
fix(ios): replace TabView with ZStack + bottom toolbar picker
TabView swallows child toolbar items (QueryEditorView's play button, overflow menu). Use ZStack with opacity switching instead — both views stay alive, toolbar items propagate correctly through the single NavigationStack. Bottom toolbar has a segmented picker for tab switching.
1 parent d3f3ca0 commit fbe773a

1 file changed

Lines changed: 14 additions & 5 deletions

File tree

TableProMobile/TableProMobile/Views/ConnectedTabView.swift

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,15 +114,15 @@ struct ConnectedTabView: View {
114114
}
115115

116116
private var tabContent: some View {
117-
TabView(selection: $selectedTab) {
117+
ZStack {
118118
TableListView(
119119
connection: connection,
120120
tables: tables,
121121
session: session,
122122
onRefresh: { await refreshTables() }
123123
)
124-
.tabItem { Label("Tables", systemImage: "tablecells") }
125-
.tag(Tab.tables)
124+
.opacity(selectedTab == .tables ? 1 : 0)
125+
.allowsHitTesting(selectedTab == .tables)
126126

127127
QueryEditorView(
128128
session: session,
@@ -133,12 +133,21 @@ struct ConnectedTabView: View {
133133
connectionId: connection.id,
134134
historyStorage: historyStorage
135135
)
136-
.tabItem { Label("Query", systemImage: "terminal") }
137-
.tag(Tab.query)
136+
.opacity(selectedTab == .query ? 1 : 0)
137+
.allowsHitTesting(selectedTab == .query)
138138
}
139139
.navigationTitle(supportsDatabaseSwitching && databases.count > 1 ? "" : displayName)
140140
.navigationBarTitleDisplayMode(.inline)
141141
.toolbar { tabToolbar }
142+
.toolbar {
143+
ToolbarItemGroup(placement: .bottomBar) {
144+
Picker("Tab", selection: $selectedTab) {
145+
Label("Tables", systemImage: "tablecells").tag(Tab.tables)
146+
Label("Query", systemImage: "terminal").tag(Tab.query)
147+
}
148+
.pickerStyle(.segmented)
149+
}
150+
}
142151
}
143152

144153
@ToolbarContentBuilder

0 commit comments

Comments
 (0)