Skip to content

LazyVStack content is rendered immediately, results in really bad performance #6

@adamvnovak

Description

@adamvnovak

I'm trying to present a screen and render hundreds of items in a LazyVStack within a ScrollView.

When using ScrollView, the screen is presented right away, and I can begin scrolling.

When using LegacyScrollView, the screen takes 4 seconds before it is presented. Subsequent updates to the view are extremely laggy. This must mean that the subviews are all rendered instantly.

            ScrollView(.vertical) {
//            LegacyScrollView(.vertical, showsIndicators: true) {  // <-- results in extreme lag
                LazyVStack {
                    Section {
                        if model.recentFriends.count > 0 {
                            Text("all")
                        }
                        ForEach(Array(model.friends.enumerated()), id: \.element) { index, friend in
                            FriendListView(friend: friend, isLastPerson: index == model.friends.count)
                        }
                    }
                }
                .font(.crimsonPro(.medium, size: 15))
                .foregroundStyle(.gray)
                .padding()
            }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions