Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 798
josephap Avatar asked Dec 17 '19 01:12

josephap


1 Answers

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.

like image 52
josephap Avatar answered Nov 28 '22 22:11

josephap