josephap
josephap

Reputation: 2285

SwiftUI: Navigation Title Stuck in Place (Scroll Animation Broken) for List in NavigationView

I have created a SwiftUI List wrapped in a NavigationView. The title for the list is set in the default way and appears fine: .navigationBarTitle("My Title"). The problem is the scrolling behavior is broken.

That is, when scrolling the list, the large title should disappear to make way for the navigation bar to appear with the small title. However, the large title is just stuck in place and does not move while the list scrolls behind it in a glitchy looking manner.

Upvotes: 8

Views: 3612

Answers (1)

josephap
josephap

Reputation: 2285

Turns out, setting the background of the List breaks the scrolling behavior. That is, removing .background(Color.red) on the List restored the scrolling behavior to normal.

Upvotes: 19

Related Questions