I discovered a really weird issue with the title on the sidebar on iPads. I’ve set the navigationBarTitleDisplayMode to .large, but on first load (right after I run the app on the simulator), the title is shown as inline but if I pull the list downwards (scrolling up), the title becomes large. It’s as if the list is scrolled up on first load. But the list is fully visible so it doesn’t really appear like it was scrolled. I hope my explanation makes sense.
Here’s a sample code:
NavigationSplitView {
VStack {
List(folders, id: .self, selection: $selectedFolder) { folder in
NavigationLink(folder.title, value: folder)
}
.navigationTitle("Test Title")
.navigationBarTitleDisplayMode(.large)
Spacer()
Button {
//Create new list
newListModalShown = true
} label: {
Text("New List")
}
}
} detail: {
if let selectedFolder {
ItemsListView(folder: selectedFolder)
} else {
Text("Select a list")
.navigationTitle("")
.navigationBarTitleDisplayMode(.inline)
}
}
Here are some screenshots of the UI:
- On app first run (actual result):
- When scrolling list downwards / expected result on first run):
I’ve done a few troubleshooting steps to check what’s causing the problem, unfortunately, I’ve not figured it out:
- I replaced the code inside the ‘List’ with just Text, just to see if the title appeared large, no go.
- Tried scrollview with a few lines of text, that seemed to work. But I’d rather stick to List
– Moved the modifer .navigationBarTitleDisplayMode around to see if that made a difference, it didn’t
I am hoping it’s just not me who experienced this problem. I’d be happy to report this as a bug if indeed it is. Just wanted to know if anybody else had found a work around.
Thanks!