Open kevin-hv opened 4 years ago
There is one logic: playWhenAppear
and pauseWhenDisappear
for SDAnimatedImageView
So this cause the initial value does not works for animation. I'll provide a fix.
Thank you. ☺️
Seems this issue caused by your SwiftUI AnimatedImage
not visible...
Not so easy to fix. Because the logic is based on current animating status != isAnimating binding property
. When the AnimnatedImage
not visible, it actually isAnimating = false
. But when visible, we can not get a immediately callback to disable that.
Maybe a temp solution, it's to turn off the autoPlayAnimatedImage
property. This is new API in SDWebImage 5.8.0.
Please have a try to use the temp workaround below, I'll try to find a solid solution for this issue:
AnimatedImage(url: url)
.onViewCreate { view
let imageView = view as! SDAnimatedImageView
imageView. autoPlayAnimatedImage = false
}
Steps to Reproduce: Create a Bool State variable, with an initial value of false Add an AnimatedImage to a View with the isAnimating property set to the State Bool which is false Build the Application
Expected Result: The animation is frozen
Actual Result: The animation is running
OS Version: 13.4.1
Device: iPhone SE (2nd generation) Simulator
Example Code: