Skip to content
This repository has been archived by the owner on Oct 24, 2024. It is now read-only.

Every scroll view is expanded upon pull to refresh #4

Open
GioPalusa opened this issue Feb 9, 2023 · 3 comments
Open

Every scroll view is expanded upon pull to refresh #4

GioPalusa opened this issue Feb 9, 2023 · 3 comments

Comments

@GioPalusa
Copy link

When the view is expanded to fit the progress spinner, every scroll view on the page is expanded. So if a scrollview has horizontal scroll views in it, they will all expand during loading

@GioPalusa
Copy link
Author

From apples documentation about alignmentGuide(_:computeValue:) "Changing the alignment of one view may have effects on surrounding views."

@mbernson
Copy link
Member

mbernson commented Feb 15, 2023

Hi,

I originally coded this scrollview for a project, but didn't end up using it in the end because it had bugs such as the one you posted here. I ended up using a regular SwiftUI List instead.

Did you figure out a solution to the problem? If you can show me a quick sample view that exhibits the problem I can look into it.

@GioPalusa
Copy link
Author

GioPalusa commented Feb 22, 2023

I managed to solve it!

In the body I changed the alignment guide to a traditional offset. I just had to update how the offset worked, and now it works like a charm!

// Your ScrollView content. If we're loading, we want
// to keep it below the loading view, hence the alignmentGuide.
content()
    .offset(y: (state == .loading) ? threshold - max(0, offset) : 0)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants