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 the rare cases that WebImage will lost animation when visibility changes. #171

Merged
merged 1 commit into from
Feb 25, 2021

Conversation

dreampiggy
Copy link
Collaborator

Always setup player to play as defaults to avoid this.

Reproduce demo:

 @State var urlString = "https://media0.giphy.com/media/3oEjHBop7WaPmuPryg/giphy.gif?cid=c3b5a7e2fdfc7510a373e125e129e199de61e11c3907222f&rid=giphy.gif"
    var body: some View {
        print("update view", urlString)
        return VStack {
            WebImage(url: URL(string: urlString), isAnimating: .constant(true))
                .resizable()
                .placeholder {
                    Rectangle().foregroundColor(.lightGray)
                }
                .indicator(.activity)
                .transition(.fade(duration: 0.5))
                .aspectRatio(contentMode: .fit)
                .frame(width: 200, height: 200)
            Button("test") {
                if urlString == "https://media0.giphy.com/media/3oEjHBop7WaPmuPryg/giphy.gif?cid=c3b5a7e2fdfc7510a373e125e129e199de61e11c3907222f&rid=giphy.gif" {
                    urlString = "https://media4.giphy.com/media/fLskTldNGlI3fISnLA/giphy.gif?cid=c3b5a7e2v2ma8dlz57l2swklkes7xi656k671vuhr5bxnkke&rid=giphy.gif"
                } else {
                    urlString = "https://media0.giphy.com/media/3oEjHBop7WaPmuPryg/giphy.gif?cid=c3b5a7e2fdfc7510a373e125e129e199de61e11c3907222f&rid=giphy.gif"
                }
            }
        }
    }

…changes. Always setup player to play as defaults to avoid this.
@dreampiggy dreampiggy added the webimage WebImage struct label Feb 25, 2021
@dreampiggy dreampiggy merged commit 0fe0ff5 into master Feb 25, 2021
@dreampiggy dreampiggy deleted the fix_rare_webimage_animating branch September 2, 2023 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
webimage WebImage struct
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant