Fix Image Crash (#1191)

This commit is contained in:
Ethan Pippin 2024-08-15 20:34:37 -06:00 committed by GitHub
parent 4d73c6dcab
commit dcb3483e8d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 12 deletions

View File

@ -38,10 +38,11 @@ extension SettingsView {
} label: { } label: {
HStack { HStack {
// TODO: check properly with non-uniform images and look for workaround // `.aspectRatio(contentMode: .fill)` on `imageView` alone
// Note: for an unknown reason, using a non uniform aspect ratio will cause a // causes a crash on some iOS versions
// "view origin is invalid" crash within SwiftUI ZStack {
imageView imageView
}
.aspectRatio(1, contentMode: .fill) .aspectRatio(1, contentMode: .fill)
.clipShape(.circle) .clipShape(.circle)
.frame(width: 50, height: 50) .frame(width: 50, height: 50)

View File

@ -56,7 +56,11 @@ struct UserProfileSettingsView: View {
isPresentingProfileImageOptions = true isPresentingProfileImageOptions = true
} label: { } label: {
ZStack(alignment: .bottomTrailing) { ZStack(alignment: .bottomTrailing) {
// `.aspectRatio(contentMode: .fill)` on `imageView` alone
// causes a crash on some iOS versions
ZStack {
imageView imageView
}
.aspectRatio(contentMode: .fill) .aspectRatio(contentMode: .fill)
.clipShape(.circle) .clipShape(.circle)
.frame(width: 150, height: 150) .frame(width: 150, height: 150)