Skip to content

Expandable-text-with-line-limit example bug #5

@mobileuidev

Description

@mobileuidev

When I try to use viewThatFits as described in the Expandable-text-with-line-limit.swift example but with a LazyVStack shows the button incorrectly when scrolling up and down, copy and paste the following code to try it out:

struct ContentView: View {
    
    var items = ["this is test text",
                 
                 "this is test text this is test text",
                 
                 " this is test text this is test text this is test text",
                 
                 "this is test text this is test text this is test text this is test text",
                 
                 "this is test text this is test text this is test text this is test text this is test text",
                 
                 "this is test text this is test text this is test text this is test text this is test text this is test text",
                 
                 "this is a small text",
                 
                 "this is test text this is test text this is test text this is test text this is test text this is test text this is test text this is test text",
                 
                 "this is test text this is test text this is test text this is test text this is test text this is test text this is test text this is test text this is test text",
                 
                 "this is test text this is test text this is test text this is test text this is test text this is test text this is test text this is test text this is test text this is test text",
                 
                 "this is test text this is test text this is test text this is test text this is test text this is test text this is test text this is test text this is test text this is test text this is test text",
    ]
    
    var body: some View {
        ScrollView {
            LazyVStack(spacing: 0) {
                ForEach(items, id: \.self) { item in
                   ExpandableTextWithLineLimit(text: item, initialLineLimit: 2)
                        .padding()
                }
            }
        }
       
    }
}

However, this issue doesn't happen with a VStack, but I need to use LazyVStack to simulate async data rendering.

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