-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Images never load if GeometryReader is used to set its frame width #1687
Comments
Ummm, I cannot reproduce this issue in the demo app in this repo. What is your Kingfisher version or is it an issue only happens on some certain device or iOS version? I also append a GIF of this, by using Is it possible for you to prepare a reproducible sample so we can have a detail look? Thanks! |
@onevcat thanks for checking. I created a minimal iOS project for that and I wasn't able to reproduce it either, so I dug a little bit and found out that the problem only happens when wrapped inside a NavigationView {
GeometryReader { geo in
KFImage(
URL(string: "https://www.apple.com/ac/structured-data/images/knowledge_graph_logo.png")!
)
.placeholder { ProgressView() }
.forceRefresh()
.resizable()
.scaledToFit()
.frame(width: geo.size.width)
}
} I overlooked this in my initial post because |
Hi @onevcat, did you have a chance to take a second look at it? |
@ruippeixotog Sure! Please give me some more time...Crazy busy recently. T-T |
Hi, @ruippeixotog I checked this in detail and it is yet another side effect as #1660 I suggest add a |
Or if you do not like the NavigationView {
GeometryReader { geo in
MyView()
.frame(width: geo.size.width)
}
}
struct MyView: View {
var body: some View {
KFImage(
URL(string: "https://www.apple.com/ac/structured-data/images/knowledge_graph_logo.png")!
)
.placeholder { ProgressView() }
.forceRefresh()
.resizable()
.scaledToFit()
}
} Frankly speaking I don't know why the original code works without a |
Thanks @onevcat, |
Nice to hear that. That was too bad the Thanks for the feedback. Please let me close this for now. |
Check List
Thanks for considering to open an issue. Before you submit your issue, please confirm these boxes are checked.
Issue Description
I have a SwiftUI view with a very simple body:
Unfortunately, this image never loads for me the first time (and I can add
.forceRefresh()
to reproduce this issue consistently). I added.onProgress
and.onSuccess
hooks and checked that while the image is downloaded successfully, KF never replaces the placeholder view with the actual image. This doesn't happen if the image is loaded from cache.This seems to be somehow related to how
GeometryReader
plays out withKFImage
. If I removeGeometryReader
, or even just assign a fixed width to the image, the image loads correctly.Is this a known issue?
The text was updated successfully, but these errors were encountered: