1

The problem is very simple. I would like a ScrollView with a navigation bar (with its two appearances : a large title when the view is not scrolled ; a compact appearance otherwise). It's simple and it works...unless the view is presented with .sheet. At the "end of the scroll", the modal begins to lower. But if the user changes his mind... a problem with the transition between the "large" and "compact" states of the navigation bar appears.

Here is the result (iOS14/15, Simulator/Device) :

(Please click, the gif is animated)

enter image description here

And the code :

struct SwiftUIView: View {
  @State private var sheet: Bool = false
   
  var body: some View {
    Button("Tap") {
      sheet.toggle()
    }.sheet(isPresented: $sheet) {
      NavigationView {
        ScrollView {
          Text(String(repeating: "lol ", count: 1000))
        }
        .navigationTitle("Haha")
      }
    }
  }
}

Thanks for your help

Adrien
  • 1,579
  • 6
  • 25
  • Interesting bug. Refactoring the view didn't help. I am not sure you can do anything other than make it `.inline` the whole time and file a Radar. – Yrb Mar 31 '22 at 18:01
  • I fear you are right @Yrb In its apps Apple rarely uses the "large title" appearance in modals. And when it does... the bug appears (Apple Store app -> Account). So it's not because of SwiftUI. – Adrien Apr 01 '22 at 10:14
  • Most likely, but it is definitely worth filing on Feedback Assistant. The more it is filed, the more likely it is to be found and fixed. – Yrb Apr 01 '22 at 11:45

0 Answers0