SDWebImageSwiftUI icon indicating copy to clipboard operation
SDWebImageSwiftUI copied to clipboard

Unable to load image within TabItem in TabView 🤔

Open foxmayurrathod opened this issue 1 year ago • 2 comments

I'm facing an issue while trying to load an image within a TabItem. I've attempted wrapping it in an HStack and applying the renderingMode, but the image isn't loading. Interestingly, when using AsyncImage, it works without a hitch. Any thoughts on why this might be occurring?

struct ContentView: View {
    
    var body: some View {
        TabView {
            FirstView()
                .tabItem {
                    Text("Menu")
                    HStack {
                        WebImage(url: URL(string: "https://fastly.picsum.photos/id/1/28/28.jpg?hmac=OWquhtLXviFlCON5jtuT0w-nHs_vBlUnSTt9OpBbk14"))
                            .resizable()
                            .renderingMode(.template)
                            
                    }
                }
            
            SecondView()
                .tabItem {
                    Text("Order")
                    AsyncImage(url: URL(string: "https://fastly.picsum.photos/id/1/28/28.jpg?hmac=OWquhtLXviFlCON5jtuT0w-nHs_vBlUnSTt9OpBbk14"))
                }
        }
    }
}

Output:

Screenshot 2024-01-10 at 12 38 36 PM

foxmayurrathod avatar Jan 10 '24 07:01 foxmayurrathod

Emmm...Need to test this.

Curious, is there using image from web, even the animated GIF, a normal usgae ?

dreampiggy avatar Jan 10 '24 10:01 dreampiggy

@dreampiggy I haven't tested the animated GIF yet, so I'm unsure about that. Regarding images from the web, I encountered an issue. However, when I load the same image in the View Body, it works without any problems

foxmayurrathod avatar Jan 10 '24 11:01 foxmayurrathod