0

The transition from the "detail view" which has inline title style to the "main view" which has large title style is not smooth. When I navigate from "detail view" the title style stays inline. This works good when the list is long and I am in the middle of the list(because I want to go back to where I was in the list and not to the top), but not when I am on top of the list. Does anyone know why and how to fix?

it is a problem when I am swiping back or tapping the back button, but also when I am clearing the navigation paths stack.video

Works fine with vstack or scrollview. probably List that is causing issues.

''' struct ContentView: View {

@State private var path: [Int] = []
var body: some View {
    NavigationStack(path: $path) {
        List {
            ForEach(0..<30) { i in
                NavigationLink(value: i) {
                    Text(String(i))
                }
            }
        }
        .navigationDestination(for: Int.self) { i in
            VStack {
                Text(String(i))
                Spacer()
                Button {
                    path.removeAll()
                } label: {
                    Text("Back")
                }
            }
            .navigationTitle("Inline title")
            .navigationBarTitleDisplayMode(.inline)
        }
        .navigationTitle("Large title")
        .navigationBarTitleDisplayMode(.large)
    }
}

} '''

albstr
  • 9
  • 5

0 Answers0