Skip to content

fix: prevent crash when KeyboardChatScrollView unmounted#1485

Merged
kirillzyusko merged 1 commit into
mainfrom
fix/android-crash-when-using-keyboard-chat-scroll-view
Jun 4, 2026
Merged

fix: prevent crash when KeyboardChatScrollView unmounted#1485
kirillzyusko merged 1 commit into
mainfrom
fix/android-crash-when-using-keyboard-chat-scroll-view

Conversation

@kirillzyusko

@kirillzyusko kirillzyusko commented Jun 3, 2026

Copy link
Copy Markdown
Owner

📜 Description

Fixed a crash on Android when using KeyboardChatScrollView.

💡 Motivation and Context

We may schedule a call to perform scrollTo later. But if the component is unmounted, then we will get a crash.

In this PR I'm adding a check to skip scrollTo operation if view was unmounted.

Based on bluesky-social/social-app#10673

📢 Changelog

JS

  • skip scrollTo if ref is null;

🤔 How Has This Been Tested?

There is no way to test it at the moment, but CI is green 🟢

📸 Screenshots (if appropriate):

image

📝 Checklist

  • CI successfully passed
  • I added new mocks and corresponding unit-tests if library API was changed

@github-actions

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

📊 Package size report

Current size Target Size Difference
318237 bytes 317920 bytes 317 bytes 📈

@kirillzyusko kirillzyusko self-assigned this Jun 3, 2026
@kirillzyusko kirillzyusko added 🎯 crash Library triggers a crash of the app KeyboardChatScrollView 💬 Anything about chat functionality 🤖 android Android specific labels Jun 3, 2026
@kirillzyusko kirillzyusko changed the title fix: prevent crash when ScrollView unmounted fix: prevent crash whenKeyboardChatScrollView unmounted Jun 4, 2026
@kirillzyusko kirillzyusko changed the title fix: prevent crash whenKeyboardChatScrollView unmounted fix: prevent crash when KeyboardChatScrollView unmounted Jun 4, 2026
@kirillzyusko kirillzyusko marked this pull request as ready for review June 4, 2026 08:16
@github-actions

github-actions Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor
  • ** scrollViewRef check prevents potential crashes when ref is invalid or unmounted**
    Why: Without the check, calling scrollTo on an invalid ref could cause runtime errors, especially if the component has been unmounted.
    Fix: The added guard clause correctly prevents this scenario.
LGTM

@kirillzyusko kirillzyusko merged commit 62ea262 into main Jun 4, 2026
17 checks passed
@kirillzyusko kirillzyusko deleted the fix/android-crash-when-using-keyboard-chat-scroll-view branch June 4, 2026 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🤖 android Android specific 🎯 crash Library triggers a crash of the app KeyboardChatScrollView 💬 Anything about chat functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant