DeckUI icon indicating copy to clipboard operation
DeckUI copied to clipboard

Fix for slide transitions when changing direction

Open mortenbekditlevsen opened this issue 1 year ago • 0 comments

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.

mortenbekditlevsen avatar Mar 29 '23 08:03 mortenbekditlevsen