Skip to content

Fix for slide transitions when changing direction - #35

Open
mortenbekditlevsen wants to merge 4 commits into
joshdholtz:mainfrom
mortenbekditlevsen:SlideTransitionFix
Open

Fix for slide transitions when changing direction#35
mortenbekditlevsen wants to merge 4 commits into
joshdholtz:mainfrom
mortenbekditlevsen:SlideTransitionFix

Conversation

@mortenbekditlevsen

@mortenbekditlevsen mortenbekditlevsen commented Mar 29, 2023

Copy link
Copy Markdown

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