Since iOS 14.5, the behaviour when pushing a new view onto a scrolled navigation view appears to have changed and no longer works the way it did on iOS 14.4
On iOS 14.4, when pushing a new view onto a NavigationView via a NavigationLink, the new view renders (as expected) with the .large NavigationBar in it's expanded state.
On iOS 14.5, with the exact same code, the new view renders with the .large NavigationBar in either an expanded or collapsed state (with the content scrolled up) depending on the state from the parent view. If you have scrolled the parent view, the navigation bar will be collapsed. If you have not scrolled the parent view the navigation bar will be expanded. This is not the behaviour I want or expect. I expect the navigation bar on the child view to always be expanded.
Code below:
struct RootView: View {
var body: some View {
NavigationView() {
ScrollView() {
VStack() {
Text("Root view")
.navigationTitle("Root")
.navigationBarTitleDisplayMode(.large)
.padding()
ForEach(0...50, id: \.self){ i in
NavigationLink(
destination:DetailView(title: "Link \(i)")
){
Text("Link \(i)")
}
}
}
}
}
.navigationViewStyle(StackNavigationViewStyle())
}
}
struct DetailView: View {
var title: String
var body: some View {
ScrollView() {
VStack() {
Text(title)
.navigationTitle("Detail")
.navigationBarTitleDisplayMode(.large)
ForEach(0...50, id: \.self) { x in
Text("Scroll content! \(x)")
}
}
}
}
}
Am I doing something wrong in how I set up the views?