ScrollKit icon indicating copy to clipboard operation
ScrollKit copied to clipboard

Can i detect when ScrollView has finished scrolling?

Open gzlboy opened this issue 1 year ago • 4 comments

I want to do something when scroll was finished.How can I do this? Thanks!

gzlboy avatar May 28 '24 02:05 gzlboy

Do you mean that when a scroll event ends and the offset stops updating?

danielsaidi avatar May 30 '24 07:05 danielsaidi

Yes!I find a repository that implemented this feature: https://github.com/fatbobman/IsScrolling

In addition to the scrolling state, it will be better if i can get the scrolling direction:)

gzlboy avatar Jun 02 '24 00:06 gzlboy

Would be cool to support! I'll take a look when I get around to this project, and can meanwhile approve and merge any PR that fixes this.

danielsaidi avatar Jun 03 '24 13:06 danielsaidi

Thanks! Look forward to this feature:)

gzlboy avatar Jun 04 '24 13:06 gzlboy

@gzlboy If you have the possibility to use iOS 18 and macOS 15, it has a new .onScrollPhaseChange modifier:

.onScrollPhaseChange { _, newPhase in
     ...
}

Since the SDKs scroll views use regular ScrollView underneath, you should be able to add this modifier to its content.

Since there is a native way to do this now, I will not add this to the SDK, and will thus close this issue. If you miss some feature in the SDK to be able to use it, please let me know.

danielsaidi avatar Oct 05 '24 09:10 danielsaidi