Skip to content

Commit 2b60ceb

Browse files
graycreateclaude
andcommitted
fix: address Copilot review comments
- Update comment to be more accurate about content jumping prevention - Use userName computed property consistently in AuthorInfoView - Restore scroll-based title bar animation with List using PreferenceKey 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent daf2adc commit 2b60ceb

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

V2er/View/FeedDetail/AuthorInfoView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ struct AuthorInfoView: View {
8585
.background(
8686
Group {
8787
NavigationLink(destination: TagDetailPage(tag: tag, tagId: tagId), isActive: $navigateToTag) { EmptyView() }
88-
NavigationLink(destination: UserDetailPage(userId: data?.userName ?? .empty), isActive: $navigateToUser) { EmptyView() }
88+
NavigationLink(destination: UserDetailPage(userId: userName), isActive: $navigateToUser) { EmptyView() }
8989
}
9090
.hidden()
9191
)

V2er/View/FeedDetail/FeedDetailPage.swift

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@
99
import SwiftUI
1010
import SafariServices
1111

12+
private struct ScrollOffsetPreferenceKey: PreferenceKey {
13+
static var defaultValue: CGFloat = 0
14+
static func reduce(value: inout CGFloat, nextValue: () -> CGFloat) {
15+
value = nextValue()
16+
}
17+
}
18+
1219
struct FeedDetailPage: StateView, KeyboardReadable, InstanceIdentifiable {
1320
@Environment(\.isPresented) private var isPresented
1421
@Environment(\.dismiss) var dismiss
@@ -107,6 +114,14 @@ struct FeedDetailPage: StateView, KeyboardReadable, InstanceIdentifiable {
107114
.listRowInsets(EdgeInsets())
108115
.listRowSeparator(.hidden)
109116
.listRowBackground(Color.itemBg)
117+
.background(
118+
GeometryReader { geometry in
119+
Color.clear.preference(
120+
key: ScrollOffsetPreferenceKey.self,
121+
value: geometry.frame(in: .named("listScroll")).minY
122+
)
123+
}
124+
)
110125

111126
// Content Section
112127
if !isContentEmpty {
@@ -166,6 +181,12 @@ struct FeedDetailPage: StateView, KeyboardReadable, InstanceIdentifiable {
166181
.onTapGesture {
167182
replyIsFocused = false
168183
}
184+
.coordinateSpace(name: "listScroll")
185+
.onPreferenceChange(ScrollOffsetPreferenceKey.self) { offset in
186+
withAnimation {
187+
hideTitleViews = offset > -100
188+
}
189+
}
169190
}
170191

171192
private var replyBar: some View {

V2er/View/Widget/Updatable/UpdatableView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ struct UpdatableView<Content: View>: View {
112112
private func onScroll(point: CGPoint) {
113113
let newScrollY = point.y
114114

115-
// Detect bottom overscroll - skip state updates to prevent LazyVStack jumping
115+
// Detect bottom overscroll - skip state updates to prevent content jumping during bottom overscroll
116116
let isBottomOverscroll = boundsDelta > 0 && newScrollY < -boundsDelta - 5
117117
if isBottomOverscroll {
118118
lastScrollY = newScrollY

0 commit comments

Comments
 (0)