When combining a zoom navigationTransition with a List in a NavigationStack we end up getting the navigationTitle not properly re-positioning itself on dismiss/back. It looks like a visual bug/glitch (unless I missed something).
This seems to not happen with a ScrollView
import SwiftUI
struct Item: Identifiable {
let id: UUID = UUID()
}
struct ContentView: View {
@State private var selected: Item?
@Namespace private var animation
var body: some View {
NavigationStack {
List {
ForEach((0..<50).map { _ in Item() }, id: \.id) { item in
Button {
selected = item
} label: {
Text(item.id.uuidString)
.frame(maxWidth: .infinity, alignment: .leading)
}
.matchedTransitionSource(id: item.id, in: animation)
}
}
.navigationTitle("Title")
.navigationSubtitle("Subtitle")
}
.fullScreenCover(item: $selected) { item in
Text(item.id.uuidString)
.frame(maxWidth: .infinity)
.navigationTransition(.zoom(sourceID: item.id, in: animation))
}
}
}
#Preview {
ContentView()
}
Topic:
UI Frameworks
SubTopic:
SwiftUI