Post

Replies

Boosts

Views

Activity

TabView more tab has double navigation bar when there's more than five tabs
When there are more than 5 tabs in TabView, the tabs from the 5th and on get put in the "More" tab as a list. But when each tab has its own NavigationStack, the tabs in "More" would have double navigation bars. The expected behavior is there should be only one navigation bar, and NavigationStack for tabs in "More" should be collapsed with navigation for the "More" tab itself. Minimal reproducible case: Run the code below as an app Navigate to "More" tab Navigate to "Tab 5" or "Tab 6" You can see there are two navigation bars stacked on top of each other struct Item: Identifiable { let name: String var id: String { name } } @main struct TestApp: App { var body: some Scene { WindowGroup { ContentView() } } } struct ContentView: View { let items = [ Item(name: "Tab 1"), Item(name: "Tab 2"), Item(name: "Tab 3"), Item(name: "Tab 4"), Item(name: "Tab 5"), Item(name: "Tab 6"), ] var body: some View { TabView { ForEach(items) { item in NavigationStack { List { Text(item.name) }.navigationTitle(item.name) }.tabItem { Label(item.name, systemImage: "person") } } } } } Before iOS 18, I can get around this issue by making my own "More" tab. But now with the expectation that user can re-arrange the tabs and all tabs would show up in the sidebar, the "make my own more tab" approach no longer work very well.
3
1
254
Sep ’24