Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for slide transitions when changing direction #35

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

mortenbekditlevsen
Copy link

@mortenbekditlevsen mortenbekditlevsen commented Mar 29, 2023

The transition for removal used by SwiftUI
is the one that was set when rendering the slide.

This means that when changing navigation direction,
the animation would be wrong for the first transition
after changing direction.

By first updating the transition (causing a re-render
that doesn't change anything but the transition)
And then - in the next render loop - changing the
slide index, then we get the appropriate transition
even when changing directions.

This could be optimized to only perform the sleep
upon changing directions - by remembering the previous
transition direction and testing to see if it's
necessary to change the transition and re-render.

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

Successfully merging this pull request may close these issues.

1 participant