From 4595a9b69f5b9712abfffee14486640fd0967e55 Mon Sep 17 00:00:00 2001 From: Ilyas Hallak Date: Fri, 10 Oct 2025 20:23:38 +0200 Subject: [PATCH] fix: Add explicit width constraint to headerView in BookmarkDetailView2 Changed headerView from var to func with width parameter, matching LegacyView. Added .frame(width: width, height: headerHeight) to constrain header image width. This was the root cause of content overflow - without explicit width on the header image, the entire ZStack and its children (including title and webview) could grow beyond viewport width. Now matches LegacyView implementation exactly. --- readeck/UI/BookmarkDetail/BookmarkDetailView2.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/readeck/UI/BookmarkDetail/BookmarkDetailView2.swift b/readeck/UI/BookmarkDetail/BookmarkDetailView2.swift index 44222fe..4f1117a 100644 --- a/readeck/UI/BookmarkDetail/BookmarkDetailView2.swift +++ b/readeck/UI/BookmarkDetail/BookmarkDetailView2.swift @@ -101,7 +101,7 @@ struct BookmarkDetailView2: View { VStack(spacing: 0) { ZStack(alignment: .top) { - headerView + headerView(width: geometry.size.width) VStack(alignment: .leading, spacing: 16) { Color.clear.frame(width: geometry.size.width, height: viewModel.bookmarkDetail.imageUrl.isEmpty ? 84 : headerHeight) @@ -234,12 +234,12 @@ struct BookmarkDetailView2: View { // MARK: - ViewBuilder @ViewBuilder - private var headerView: some View { + private func headerView(width: CGFloat) -> some View { if !viewModel.bookmarkDetail.imageUrl.isEmpty { ZStack(alignment: .bottomTrailing) { CachedAsyncImage(url: URL(string: viewModel.bookmarkDetail.imageUrl)) .aspectRatio(contentMode: .fill) - .frame(height: headerHeight) + .frame(width: width, height: headerHeight) .clipped() // Zoom icon @@ -262,7 +262,7 @@ struct BookmarkDetailView2: View { .padding(.trailing, 16) .padding(.bottom, 16) } - .frame(height: headerHeight) + .frame(width: width, height: headerHeight) .ignoresSafeArea(edges: .top) .onTapGesture { showingImageViewer = true