\n","author":{"@type":"Person","name":"Scott w"},"upvoteCount":2,"answerCount":1,"acceptedAnswer":null}}
Reputation: 525
I have two views a scrollable ContentView which does not have a NavigationBar and an InnerView that does have a NavigationBar shown as inline. The issue that I'm having is that if I navigate to the InnerView and the back to the ContentView the ScrollView flickers when it bounces on the top of the screen. It's as though the scrollView still believes the NavigationBar is still present. Does anyone know of a way to fix this seems like a bug?
import SwiftUI
struct Example: View {
var body: some View {
HStack {
Text("Example")
.frame(maxWidth: .infinity)
.frame(height: 245)
}
}
}
struct ContentView: View {
var body: some View {
ZStack {
HStack {
NavigationView {
ScrollView {
NavigationLink(destination: HStack {
Text("Hello")
.navigationBarTitle("Hello", displayMode: .inline)
.navigationBarHidden(false)
}) {
VStack {
Example()
Example()
Example()
Example()
}
}
Text("Hello, World!")
}.navigationBarTitle("")
.navigationBarHidden(true)
}
}
}
}
}
Upvotes: 2
Views: 1133
Reputation: 81
Add
.navigationBarTitle("", displayMode: .inline)
or
.navigationBarTitleDisplayMode(.inline)
Upvotes: 3