gh123man / SwiftUI-Refresher

A native, customizable SwiftUI refresh control
MIT License
129 stars 12 forks source link

Refresh appear in front of searchbar #2

Closed AzSiAz closed 2 years ago

AzSiAz commented 2 years ago

Not sure if something can be done about this but just in case image

gh123man commented 2 years ago

I have not tried the search bar yet. I'll try to reproduce it and see if I can work around it.

gh123man commented 2 years ago

Ok I think I reproduced the behavior - let me know if this is what you are seeing:

spinner overlayed by search bar during animation

search-weird

It looks like it only overlays the search bar while you are scrolling - which is currently unavoidable.

it appears this is not a problem on a sub-page in the navigation stack:

Good behavior on subview

search-better

I recommend using the default style in these cases since it works nicer with "fixed" headers (like the search bar)

How it looks with style: .default

search-default

Other bugs

AzSiAz commented 2 years ago

It's also going over (under ?) LargeTitle (in subview) from what I am seeing on my app with .system style but as you say for searchbar this is also unavoidable I think

I think it's not a problem with the searchbar but with navbar and large title I am going to switch to inline title and use .default when not possible

gh123man commented 2 years ago

@AzSiAz How do you feel about this as a fix? I know it's not exactly like the system refresher. but it solves the problem of needing to be in a fixed part of the screen and looks pretty similar.

I am thinking of adding this as style: .system2. fix

gh123man commented 2 years ago

I pushed this change in 1.0.9. use style: .system2. Ill add it to the readme/examples once it's stable (I haven't tested it thoroughly)

AzSiAz commented 2 years ago

Might work for some people, not sure how I feel about it I think refresh icon appear to late for my taste 🤔 Still it might be useful for some people so it's a nice addition 👍

Not sure it's possible but since animation & large title min and max are constant is it possible to detect/pass a bool to refresher for large title and apply some kind of offset on scroll down (for .system) ?

gh123man commented 2 years ago

Not sure it's possible but since animation & large title min and max are constant is it possible to detect/pass a bool to refresher for large title and apply some kind of offset on scroll down

(if I am understanding this correctly) that's what style: .system2 is doing. As you pull down a spacer is opened up at the top of the scrollview to push down the content and the refresh spinner is centered in that view.

Conversely with style: .system - the spacer is only added after the scroll is released and the spinner is offset inverse to the scroll amount (so it stays in a fixed location on the screen). So a nice middle ground may be to use .system2 for large title views, and .system for subviews that have a fixed navbar.

AzSiAz commented 2 years ago

(if I am understanding this correctly) that's what style: .system2 is doing. As you pull down a spacer is opened up at the top of the scrollview to push down the content and the refresh spinner is centered in that view.

Ah, my bad. I should have read the commit code 😅

I just tried system2 and it seem largely good enough for a third party refresher limited by what is currently possible with SwiftUI navbar, let's hope they add refreshable support to ScrollView at WWDC22

Closing since system2 is the answer to my problem, thanks 😄