fermoya / SwiftUIPager

Native Pager in SwiftUI
MIT License
1.29k stars 171 forks source link

[FEAT] Provide something like interactive(scale:) for custom animators or method like didScroll #277

Closed AndriiPetrovDev closed 2 years ago

AndriiPetrovDev commented 2 years ago

It would be nice to have the ability to track all scroll way between Pages. .onDraggingChanged works great but only when the user touches the screen. As fast as the user finishes the pan gesture progress stops. But I need to continue my custom animation (for example change background color)

fermoya commented 2 years ago

Hi @AndrewPetrov let me see if I understand you. So if you start scrolling and it's enough to move forward, onDraggingChanged reports while there's a touch but as soon as you let go and the animation starts then you don't get reported. Is that it?

I don't have any way to get that information but you could do the following. You can calculate a progress based on that offset that's changed and then once onDraggingEnded is called then you finish the animation.