Fix Image Crash (#1191)
This commit is contained in:
parent
4d73c6dcab
commit
dcb3483e8d
|
@ -38,13 +38,14 @@ 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)
|
}
|
||||||
.clipShape(.circle)
|
.aspectRatio(1, contentMode: .fill)
|
||||||
.frame(width: 50, height: 50)
|
.clipShape(.circle)
|
||||||
|
.frame(width: 50, height: 50)
|
||||||
|
|
||||||
Text(userSession.user.username)
|
Text(userSession.user.username)
|
||||||
.fontWeight(.semibold)
|
.fontWeight(.semibold)
|
||||||
|
|
|
@ -56,11 +56,15 @@ struct UserProfileSettingsView: View {
|
||||||
isPresentingProfileImageOptions = true
|
isPresentingProfileImageOptions = true
|
||||||
} label: {
|
} label: {
|
||||||
ZStack(alignment: .bottomTrailing) {
|
ZStack(alignment: .bottomTrailing) {
|
||||||
imageView
|
// `.aspectRatio(contentMode: .fill)` on `imageView` alone
|
||||||
.aspectRatio(contentMode: .fill)
|
// causes a crash on some iOS versions
|
||||||
.clipShape(.circle)
|
ZStack {
|
||||||
.frame(width: 150, height: 150)
|
imageView
|
||||||
.shadow(radius: 5)
|
}
|
||||||
|
.aspectRatio(contentMode: .fill)
|
||||||
|
.clipShape(.circle)
|
||||||
|
.frame(width: 150, height: 150)
|
||||||
|
.shadow(radius: 5)
|
||||||
|
|
||||||
Image(systemName: "pencil.circle.fill")
|
Image(systemName: "pencil.circle.fill")
|
||||||
.resizable()
|
.resizable()
|
||||||
|
|
Loading…
Reference in New Issue