-
Notifications
You must be signed in to change notification settings - Fork 48
feat: add placeholder height for topic content area #135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
785390d to
5e38467
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds a placeholder height mechanism to the topic content area to prevent layout jumps during content rendering. The implementation introduces state tracking to detect when RichContentView completes rendering and applies a minimum height constraint that transitions away once content is ready.
Key Changes
- Introduces
contentReadystate to track RichContentView rendering completion - Utilizes the
onRenderCompletedcallback to detect when content finishes rendering - Applies a 60% screen height minimum constraint while loading, transitioning to actual content height
| } | ||
| .padding(.horizontal, 12) | ||
| .padding(.vertical, 8) | ||
| .frame(minHeight: contentReady ? 0 : UIScreen.main.bounds.height) |
Copilot
AI
Dec 29, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using UIScreen.main.bounds directly in SwiftUI is not the recommended approach and can cause issues with multitasking on iPad, scene-based apps, and dynamic sizing. The preferred approach is to use GeometryReader to get the size of the containing view. Replace UIScreen.main.bounds.height * 0.6 with a GeometryReader-based solution to get the proper container height.
| withAnimation(.easeInOut(duration: 0.2)) { | ||
| contentReady = true | ||
| } | ||
| } | ||
| .padding(.horizontal, 12) | ||
| .padding(.vertical, 8) | ||
| .frame(minHeight: contentReady ? 0 : UIScreen.main.bounds.height) |
Copilot
AI
Dec 29, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The animation wrapper around the state change in onRenderCompleted will not animate the frame transition. The withAnimation block animates the state change itself, but the frame modifier on line 50 doesn't implicitly animate. To achieve smooth height transition, either remove the withAnimation wrapper (since the frame change will be instantaneous anyway) or move the animation modifier to the frame itself using .animation(.easeInOut(duration: 0.2), value: contentReady) after the frame modifier.
| withAnimation(.easeInOut(duration: 0.2)) { | |
| contentReady = true | |
| } | |
| } | |
| .padding(.horizontal, 12) | |
| .padding(.vertical, 8) | |
| .frame(minHeight: contentReady ? 0 : UIScreen.main.bounds.height) | |
| contentReady = true | |
| } | |
| .padding(.horizontal, 12) | |
| .padding(.vertical, 8) | |
| .frame(minHeight: contentReady ? 0 : UIScreen.main.bounds.height) | |
| .animation(.easeInOut(duration: 0.2), value: contentReady) |
Code Coverage Report ❌Current coverage: 0% |
Hide postscripts and reply sections until topic content finishes rendering: - Add onContentReady callback to NewsContentView - Add contentReady state to FeedDetailPage - Show postscripts and replies only after content renders (or if no content) - Smooth animation when sections appear This prevents seeing reply section while content is still loading. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
5e38467 to
3a1056c
Compare
Code Coverage Report ❌Current coverage: 33.79% |
Summary
Add minimum height placeholder for the topic content area while content is rendering to prevent layout jumps.
Changes
contentReadystate to track when RichContentView finishes renderingonRenderCompletedcallback to detect render completionTest plan
🤖 Generated with Claude Code