Skip to content

Unable to load image within TabItem in TabView 🤔 #295

Open
@foxmayurrathod

Description

@foxmayurrathod

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions