navigationBarTitle doesn't hide when scrolling up

If I add the background color

Color.red.edgesIgnoringSafeArea(.all)
when I scroll up on the texts, the navigationBarTitle doesn't display inline as it should, how can i fix it?


struct ContentView : View {
  var body: some View {
  NavigationView {
  ZStack {
  Color.red.edgesIgnoringSafeArea(.all)
  ScrollView {
  Group {
  Text("Example")
  .padding(.bottom, 30)
  Text("Example")
  }
  }
  .navigationBarTitle("title")
  }
  }
  }
}


I also tried this:


NavigationView {
  GeometryReader { gp in
  Color.purple.edgesIgnoringSafeArea(.all)
  ScrollView {
  ZStack(alignment: .top) {
  VStack {
  VStack {
  Text("wef")
  }
  Spacer()
  }
  }.frame(minHeight: gp.size.height)
  }
  .navigationBarTitle("Gallery")
  }
}


but the text goes all the way to the left top, when it should be centered

navigationBarTitle doesn't hide when scrolling up
 
 
Q