Skip to content

fix(mobile): Keep chat pinned during Android keyboard open#4038

Open
juliusmarminge wants to merge 2 commits into
pingdotgg:mainfrom
juliusmarminge:codex/pr3910-android-keyboard-scroll
Open

fix(mobile): Keep chat pinned during Android keyboard open#4038
juliusmarminge wants to merge 2 commits into
pingdotgg:mainfrom
juliusmarminge:codex/pr3910-android-keyboard-scroll

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Jul 16, 2026

Copy link
Copy Markdown
Member

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 check and 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

  • Adds a swizzled setContentInset: on the decorated iOS UIScrollView that restores the previous contentOffset after an inset change, preventing re-clamping when the user is not dragging or decelerating.
  • Introduces adjustedInsetCompensation and contentInsetStartCompensation props to KeyboardChatScrollView, allowing scroll offset clamping to floor at a negative value equal to the adjusted top inset instead of zero.
  • Threads both new props through useChatKeyboard, useExtraContentPadding, and computeIOSContentOffset so keyboard-driven scroll adjustments respect the adjusted inset on non-inverted lists.
  • Behavioral Change: non-inverted iOS scroll views can now hold a negative contentOffset down 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.13 patch so chat threads stay pinned when the keyboard or composer changes inset/offset math.

On iOS, swizzles setContentInset: on the decorated scroll view to restore contentOffset after inset updates when the user isn’t dragging—avoiding UIKit snapping lists that rest at a negative offset under a translucent header back to 0.

Adds adjustedInsetCompensation and contentInsetStartCompensation to KeyboardChatScrollView and threads them through keyboard/padding worklets so non-inverted scroll clamps use a minimum offset of -contentInsetStartCompensation (not 0) and bottom safe-area is included in max-scroll/pinning math. onContentInsetChange reports 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.

juliusmarminge and others added 2 commits July 16, 2026 10:54
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 13993a5e-f4f8-4973-9f60-85f9cc92f86e

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Jul 16, 2026
@juliusmarminge juliusmarminge marked this pull request as ready for review July 16, 2026 09:25
@macroscopeapp

macroscopeapp Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant