Skip to content

Sticky Scroll View #10

@mdoyle1

Description

@mdoyle1

I'm getting strange scroll view behavior when using SwiftUIRefresh on multiple lists within the same view.

Check out the original code...
https://stackoverflow.com/questions/62566029/pull-to-refresh-swiftui-swiftuirefresh-sticky-scroll-view

I have a list encompassing views containing ForEach content that will populate the list depending on conditionals.
Basic idea below.

List{
if showStateArray == false {
     if showOriginalContent {
        ForEach(originalItem){content in
        Text(content)
        } else {
                   ForEach(modifiedItem){content in
                   Text(content)
                    }
    }
 if showStateArray {
    ForEach(array){item in 
    Text(item) }
    .pullToRefresh
    }

}.pullToRefresh

The problem occurs when showStateArray is true.
The ForEach content is displayed, .pullToRefresh works as expected but the scroll behavior changes.
When you scroll and lift the list stops moving immediately. It's frustrating when dealing with long lists.

If I remove .pullToRefresh from the showStateArray is true ForEach and .pullToRefresh only applied to the List{} block, .pullToRefresh works on every thing in the block except when showStateArray is true.
In this case, when showStateArray is true .pullToRefresh doesn't want to work on the list displayed.

The issue seems to be intermittent on my iPhone but constant on the iPad.
running 13.5.1 on both.

I may have overlooked something in my code but I'm not sure if any one else has had this issue or has a solution.

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