A simple NavigationLink
to a List
view gives me the following strange behavior. After the navigation successfully occurs, the list abruptly shifts to where the title and back button are no longer on the screen:
Here is the code (Xcode 11.5). Any idea what's going on?
struct ContentView: View {
var body: some View {
NavigationView {
NavigationLink(destination: ListView()) {
Text("Go to List View ›")
}.navigationBarTitle("").navigationBarHidden(true)
}
}
}
struct ListView: View {
var body: some View {
List {
ForEach(0 ..< 3) { person in
HStack {
Image(systemName: "person.crop.circle.fill")
.resizable().frame(width: 80, height: 80)
Text("User \(person+1)")
}
}
}.listStyle(GroupedListStyle())
.navigationBarTitle("List")
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}