From f3e89bd1a75da70efeef05005e0e430f83043b5a Mon Sep 17 00:00:00 2001 From: Stefan Ceriu Date: Thu, 12 Jun 2025 09:41:20 +0300 Subject: [PATCH] Fixes #4180 - Prevent room header autolayout crashes on iOS 26. --- .../Other/SwiftUI/Views/RoomHeaderView.swift | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/ElementX/Sources/Other/SwiftUI/Views/RoomHeaderView.swift b/ElementX/Sources/Other/SwiftUI/Views/RoomHeaderView.swift index 232cf2aca..0bd8dcfb7 100644 --- a/ElementX/Sources/Other/SwiftUI/Views/RoomHeaderView.swift +++ b/ElementX/Sources/Other/SwiftUI/Views/RoomHeaderView.swift @@ -17,6 +17,18 @@ struct RoomHeaderView: View { let mediaProvider: MediaProviderProtocol? var body: some View { + if #available(iOS 26, *) { + // https://github.com/element-hq/element-x-ios/issues/4180 + // Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'NSLayoutConstraint constant is not finite! + content + } else { + content + // Take up as much space as possible, with a leading alignment for use in the principal toolbar position + .frame(idealWidth: .greatestFiniteMagnitude, maxWidth: .infinity, alignment: .leading) + } + } + + private var content: some View { HStack(spacing: 8) { avatarImage .accessibilityHidden(true) @@ -32,8 +44,6 @@ struct RoomHeaderView: View { } } } - // Take up as much space as possible, with a leading alignment for use in the principal toolbar position. - .frame(idealWidth: .greatestFiniteMagnitude, maxWidth: .infinity, alignment: .leading) } private var avatarImage: some View {