2

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)
                }
            }
        }
        
    }
}

the bug in action

1

1 Answer 1

3

Add

.navigationBarTitle("", displayMode: .inline)

or

.navigationBarTitleDisplayMode(.inline)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.