SwiftUI's ScrollView glitches with LazyVStack

59 Views Asked by At

I am not sure about the exact conditions, but sometimes glitches occur in LazyVStack. They seem to occur more often when nested, although it is not strictly necessary to reproduce the issue. When scrolling back in LazyVStack an extra space occasionally appears. At times, this space may become less than intended, or cause the scroll to just jump.

The issue is worsened by the fact that we almost have to nest them due to our app's layout. Basically, we have scrolls with a lot of content, so we need lazy loading. Additionally, we have nested cards with a lot of content inside, similar to the video in the repository. However, the nested cards are much larger, exceeding the screen's height.

I believe there were some other issues with LazyVStack in ScrollView which caused stuttering, but those were fixed, when this one still reproduces on Xcode 15.3 and iOS 17.4

I've made a minimal reproducible example of that issue

https://github.com/Almaz5200/LazyVStackGlitchExample

It includes several LazyVStacks nested in each other, the layout is pretty simple but enough to reproduce the problem. I am yet to understand which parts of it exactly cause it. Sometimes it just randomly disappears after changing something minor

0

There are 0 best solutions below