onevcat 3 gadi atpakaļ
vecāks
revīzija
5625aa934e
1 mainītis faili ar 10 papildinājumiem un 0 dzēšanām
  1. 10 0
      Sources/SwiftUI/KFImageRenderer.swift

+ 10 - 0
Sources/SwiftUI/KFImageRenderer.swift

@@ -69,6 +69,16 @@ struct KFImageRenderer<HoldingView> : View where HoldingView: KFImageHoldingView
                 }
             }
         }
+        // Workaround for https://github.com/onevcat/Kingfisher/issues/1988
+        // on iOS 16 there seems to be a bug that when in a List, the `onAppear` of the `ZStack` above in the
+        // `binder.loadedImage == nil` not get called. Adding this empty `onAppear` fixes it and the life cycle can
+        // work again.
+        //
+        // There is another "fix": adding an `else` clause and put a `Color.clear` there. But I believe this `onAppear`
+        // should work better.
+        //
+        // It should be a bug in iOS 16, I guess it is some kinds of over-optimization in list cell loading caused it.
+        .onAppear()
     }
 }