Skip to content

fix: reconcile frozen chat keyboard padding#1493

Open
jmeistrich wants to merge 1 commit into
kirillzyusko:mainfrom
jmeistrich:fix/frozen-chat-keyboard-state
Open

fix: reconcile frozen chat keyboard padding#1493
jmeistrich wants to merge 1 commit into
kirillzyusko:mainfrom
jmeistrich:fix/frozen-chat-keyboard-state

Conversation

@jmeistrich

@jmeistrich jmeistrich commented Jun 9, 2026

Copy link
Copy Markdown

Problem

In LegendList's keyboard integration when a user sends a message we want to do at the same time:

  • Scroll the new message to the top
  • Close the keyboard

So I am using freeze to disable KeyboardChatScrollView's scrolling to allow our scrollToEnd to run instead. But then that makes it never report an inset less than the keyboard height, because freezing made it stop calculating keyboard height.

KeyboardChatScrollView currently returns early from keyboard handlers when freeze is true. If the keyboard closes while frozen, the hook can miss the terminal keyboard height and keep stale keyboard padding after freeze becomes false.

In that state, onContentInsetChange can stop at the previous keyboard padding instead of continuing down to 0, even though freeze is already false.

Screenshot

This is what it looks like before the fix, it reports inset shrinking while the blankSize shrinks, but to a minimum of keyboard size (288 in this case). So then there's a big bottomInset.

Simulator Screenshot - iPhone 17 Pro - 2026-06-09 at 16 49 28

Solution

Keep tracking the latest keyboard height while frozen, but continue to skip layout and scroll writes during the frozen interval. When freeze transitions from true to false, recompute the effective padding from the latest observed keyboard height.

This keeps freeze scoped to applying keyboard-driven layout updates, not observing keyboard state.

Notes

This intentionally reconciles padding only. It does not replay skipped scroll operations after unfreezing, because that could introduce visible jumps and is not needed for the stale inset issue.

Test plan

  • Verified manually in a Legend List chat repro on iOS and Android.
  • yarn test src/components/KeyboardChatScrollView/useChatKeyboard/__tests__/index.ios.spec.ts src/components/KeyboardChatScrollView/useChatKeyboard/__tests__/freeze.android.spec.ts --runInBand
  • yarn lint --quiet src/components/KeyboardChatScrollView/useChatKeyboard/index.ios.ts src/components/KeyboardChatScrollView/useChatKeyboard/index.ts src/components/KeyboardChatScrollView/useChatKeyboard/__fixtures__/testUtils.ts src/components/KeyboardChatScrollView/useChatKeyboard/__tests__/index.ios.spec.ts src/components/KeyboardChatScrollView/useChatKeyboard/__tests__/freeze.android.spec.ts
  • yarn typescript

@kirillzyusko kirillzyusko self-assigned this Jun 9, 2026
@kirillzyusko kirillzyusko added KeyboardChatScrollView 💬 Anything about chat functionality 🐛 bug Something isn't working labels Jun 9, 2026
@kirillzyusko kirillzyusko self-requested a review June 9, 2026 14:54
@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

📊 Package size report

Current size Target Size Difference
319352 bytes 318458 bytes 894 bytes 📈

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

Labels

🐛 bug Something isn't working KeyboardChatScrollView 💬 Anything about chat functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants