fix(mobile): Keep chat pinned during Android keyboard open#4038
fix(mobile): Keep chat pinned during Android keyboard open#4038juliusmarminge wants to merge 2 commits into
Conversation
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
|
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 |
ApprovabilityVerdict: Needs human review This PR introduces a new configuration prop and modifies scroll offset clamping logic across multiple files, including native iOS code patches. The changes affect runtime scroll behavior when keyboard opens/closes, which warrants human review to verify the behavioral impact. You can customize Macroscope's approvability policy. Learn more. |
Extracted from #3910.
Updates the keyboard-controller chat-scroll patch so a composer resize racing Android keyboard opening still keeps the newest thread content above the input. Includes the matching patched-dependency lockfile update.
Validation inherited from #3910:
vp checkand mobile native lint passed before the split. The full typecheck is currently blocked in this workspace by unavailable mobile dependencies (expo-blur,expo-quick-actions, and@tabler/icons-react-native).Note
Fix chat scroll position being lost when Android keyboard opens on mobile
setContentInset:on the decorated iOSUIScrollViewthat restores the previouscontentOffsetafter an inset change, preventing re-clamping when the user is not dragging or decelerating.adjustedInsetCompensationandcontentInsetStartCompensationprops toKeyboardChatScrollView, allowing scroll offset clamping to floor at a negative value equal to the adjusted top inset instead of zero.useChatKeyboard,useExtraContentPadding, andcomputeIOSContentOffsetso keyboard-driven scroll adjustments respect the adjusted inset on non-inverted lists.contentOffsetdown to-contentInsetStartCompensation; previously the floor was always 0.Macroscope summarized ab640b5.
Note
Medium Risk
Touches native UIScrollView method swizzling and core chat scroll/keyboard offset math; regressions would show as jumpy or mis-pinned threads on iOS (and any consumers of the new inset props).
Overview
Extends the
react-native-keyboard-controller@1.21.13patch so chat threads stay pinned when the keyboard or composer changes inset/offset math.On iOS, swizzles
setContentInset:on the decorated scroll view to restorecontentOffsetafter inset updates when the user isn’t dragging—avoiding UIKit snapping lists that rest at a negative offset under a translucent header back to0.Adds
adjustedInsetCompensationandcontentInsetStartCompensationtoKeyboardChatScrollViewand threads them through keyboard/padding worklets so non-inverted scroll clamps use a minimum offset of-contentInsetStartCompensation(not0) and bottom safe-area is included in max-scroll/pinning math.onContentInsetChangereports effective bottom padding so virtualized lists can align end/maintain-scroll targets.Also drives scroll indicator inset from keyboard height only (not extra composer padding) and bumps the pnpm patch hash for the dependency.
Reviewed by Cursor Bugbot for commit ab640b5. Bugbot is set up for automated code reviews on this repo. Configure here.