NavigationView jumps when transitioning from displayMode large to inline

In a simple app with a ScrollView inside a NavigationView, on scroll the content of the scrollView doesn't smoothly transition from its size with navigationBarDisplayMode .large to .inline, but rather makes this a jarring jump.

Minimum code to reproduce:
Code Block swift
struct ContentView: View {
    var body: some View {
        NavigationView {
            ScrollView {
                ForEach(0..<200, id: \.self) { i in
                    Text("Row \(i)")
                        .frame(maxWidth: .infinity)
                }
            }
            .navigationTitle("Test")
        }
    }
}


The following code produces the desired smooth transition though:
Code Block swift
struct ContentView: View {
    var body: some View {
        NavigationView {
            List {
                ForEach(0..<200, id: \.self) { i in
                    Text("Row \(i)")
                }
            }
            .navigationTitle("Test")
        }
    }
}



I could not replicate the issue using UIKit's UITableViewController inside a UINavigationViewController, nor with a UIScrollView inside a UINavigationViewController.

Observed in simulator and on device running iOS 14 public beta (18A5319i), built with Xcode 12.0 beta 2 (12A6163b) on macOS 10.15.5 (19F101).

Post not yet marked as solved Up vote post of jakcharvat Down vote post of jakcharvat
5.8k views

Replies

Experience the same bug with beta 2, so reported it a few days ago. FB7990775 - Navigation bar jumps while scrolling.
I am also using the default navigation bar and getting the same error.

It is jumping on scrolling.

.navigationBarTitle(Text(KConstants.tabBarSummary))
 .navigationBarItems(trailing: ProfileButton(userId: UserDefaults.userMeDetails?.userId ?? -1))
Still present for me with iOS 14.2 in Xcode 12.2 b1.
This issue is still present, but here's a workaround for anyone who comes across this.
Add a padding of 0.3 to the top of your ScrollView.
Code Block
.padding(.top, 0.3)





Thanks for the workaround. Sadly not ideal as locks the NavBar into large display mode for me. 7 months on and still an issue.... :(
Just following up on the ".padding(.top, 0.3)" workaround I posted, this no longer works, but if you make the display mode ".inline" then hide, there's no jumping. 🎉

Code Block
.navigationBarTitleDisplayMode(.inline)
.navigationBarHidden(true)


The issue is still unresolved (Xcode 14.2) and is preventing us from making a good interface.

Still jumps!

Still jumps ..

Even with:

.navigationBarTitleDisplayMode(.inline)
.navigationBarHidden(true)

Still have the same issue

I still have the issue, anyone made it work?

Issue is still present on iOS 17 with NavigationStack large navigation bar title being on parent view. However, it is not present with the deprecated NavigationView. Reported the issue via FB13285300 bug number