Fix mobile legend anchor under automatic iOS insets#3684
Conversation
- Fold header inset into the anchor offset when iOS automatic content insets are enabled - Prevent new messages from anchoring under the header and snapping past earlier messages
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
| // the anchor offset or a just-sent message anchors underneath the header and | ||
| // the oversized end space keeps maintainScrollAtEnd snapping away from earlier | ||
| // messages. | ||
| const anchorTopInset = usesNativeAutomaticInsets ? insets.top + 44 : topContentInset; |
There was a problem hiding this comment.
🟡 Medium threads/ThreadFeed.tsx:1186
anchorTopInset hard-codes the iOS header height as insets.top + 44, but the actual React Navigation native header height varies by device and orientation (e.g. iPad defaults are taller than 44 pt). On those devices the computed anchoredEndSpace is too small, so a newly sent anchored message can remain partially under the header and maintainScrollAtEnd keeps snapping to the wrong position — the same regression this PR intends to fix. Consider using useHeaderHeight() from @react-navigation/elements instead of the hardcoded 44.
🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
In file @apps/mobile/src/features/threads/ThreadFeed.tsx around line 1186:
`anchorTopInset` hard-codes the iOS header height as `insets.top + 44`, but the actual React Navigation native header height varies by device and orientation (e.g. iPad defaults are taller than 44 pt). On those devices the computed `anchoredEndSpace` is too small, so a newly sent anchored message can remain partially under the header and `maintainScrollAtEnd` keeps snapping to the wrong position — the same regression this PR intends to fix. Consider using `useHeaderHeight()` from `@react-navigation/elements` instead of the hardcoded `44`.
ApprovabilityVerdict: Needs human review 1 blocking correctness issue found. This bug fix has an unresolved review comment identifying that the hardcoded header height of You can customize Macroscope's approvability policy. Learn more. |
Summary
maintainScrollAtEndfrom snapping to the wrong position when UIKit-managed insets are in play.Testing
apps/mobile/src/features/threads/ThreadFeed.tsxanchor calculations.Note
Low Risk
Single-path change to anchor offset calculation in ThreadFeed; scroll UX only, no auth or data handling.
Overview
On iOS when
usesAutomaticContentInsetsis enabled, the thread feed now feedsanchorTopInset(safe area top + 44) intoresolveChatListAnchoredEndSpaceinstead oftopContentInset.LegendList’s anchoring runs in JS and measures from the scroll view frame top, so it does not account for the header space UIKit puts in
adjustedContentInset. Folding that header height intoanchorOffsetkeeps newly sent messages from sitting under the transparent header and stopsmaintainScrollAtEndfrom snapping to the wrong position due to oversized end space.Reviewed by Cursor Bugbot for commit 5b66a6e. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Fix mobile legend anchor offset when using automatic iOS insets in
ThreadFeedWhen
usesAutomaticContentInsetsis true on iOS, UIKit adjusts the scroll view's content inset automatically, sotopContentInsetno longer reflects the true top offset used for anchoring. A newanchorTopInsetvalue derived frominsets.top + 44is used instead, correcting the anchor position computed byresolveChatListAnchoredEndSpace. Behavior is unchanged when automatic insets are not in use.📊 Macroscope summarized 5b66a6e. 1 file reviewed, 0 issues evaluated, 0 issues filtered, 0 comments posted
🗂️ Filtered Issues
No issues evaluated.