mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 12:07:55 +00:00
Fixes #3173 - Force frame sizes for timeline items that are missing sizing info.
This commit is contained in:
committed by
Stefan Ceriu
parent
10fcb5575d
commit
65bacfaae3
@@ -11,6 +11,7 @@ extension View {
|
||||
/// Constrains the max height of a media item in the timeline, whilst preserving its aspect ratio.
|
||||
@ViewBuilder
|
||||
func timelineMediaFrame(height contentHeight: CGFloat?, aspectRatio contentAspectRatio: CGFloat?) -> some View {
|
||||
let defaultMediaSize = 100.0
|
||||
let minMediaHeight = 100.0
|
||||
let maxMediaHeight = 300.0
|
||||
|
||||
@@ -23,9 +24,8 @@ extension View {
|
||||
.frame(maxHeight: min(maxMediaHeight, max(minMediaHeight, contentHeight ?? .infinity)))
|
||||
// Required to prevent the reply details to get higher priority in rendering the width of the view.
|
||||
.aspectRatio(contentAspectRatio, contentMode: .fit)
|
||||
} else { // Otherwise let the image load and use its native aspect ratio with a max height
|
||||
aspectRatio(contentMode: .fit)
|
||||
.frame(maxHeight: maxMediaHeight)
|
||||
} else { // Otherwise force the image to be `defaultMediaSize` x `defaultMediaSize`
|
||||
frame(width: defaultMediaSize, height: defaultMediaSize)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user