Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ProgressView hides on list scroll

Tags:

ios

swift

swiftui

I have a List with a ProgressView and some rows. When I scroll the List down and up again, the ProgressView get hidden, I notice this bug only with a certain number of rows, for example on iPhone 13 you can reproduce this bug if you have 20 rows.

struct ContentView: View {
    var body: some View {
        List {
            ProgressView()
            ForEach(0..<20, id: \.self) {
                Text("\($0)")
            }
        }
    }
}

like image 209
Fawzi Rifai Avatar asked Mar 30 '26 22:03

Fawzi Rifai


1 Answers

I know that it's probably too late. But I also had this problem and figured it might be caused by SwiftUI "recovering" your previously used view that (for some reason) it's now hidden.

So what I did to fix this was just adding a unique ID to my progress view, this way SwiftUI won't try to re-utilize it.

Ex:

ProgressView().id(UUID())
like image 53
EdYuTo Avatar answered Apr 02 '26 13:04

EdYuTo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!