Skip to content

fix: OverKeyboardView crash#913

Merged
kirillzyusko merged 2 commits intomainfrom
fix/over-keyboard-view-crash
Apr 11, 2025
Merged

fix: OverKeyboardView crash#913
kirillzyusko merged 2 commits intomainfrom
fix/over-keyboard-view-crash

Conversation

@kirillzyusko
Copy link
Copy Markdown
Owner

@kirillzyusko kirillzyusko commented Apr 10, 2025

📜 Description

Wrapped touch events in try/catch.

💡 Motivation and Context

The problem stems from the fact, that we are trying to cast ViewRootImpl to ViewGroup (viewrootimpl cannot be cast to android.view.viewgroup). Basically it happens when touch gets propagated until RootView and wasn't handled earlier. Such thing can happen when:

I was aware about that issue (especially on Fabric) and decided not to fix it - the main motivation was to stretch view to full screen on Fabric. However now, when view gets stretched we still have a small race condition when users click fast (i. e. view is not laid out but user already pass a touch).

I don't know a proper fix for this problem, and for me it looks like it can be OS scheduling/management which can not be fixed because I don't have an access to it 😅

So in this PR I simply wrap the touch handling in try/catch. If touch can not be handled then it's better to silently fail instead of crashing the app.

Closes #884

📢 Changelog

Android

  • wrapped handleTouchEvent calls inside try/catch block to prevent a crash;

🤔 How Has This Been Tested?

Tested manually on Medium Phone API 35.

📸 Screenshots (if appropriate):

Screen.Recording.2025-04-11.at.11.36.05.mov

📝 Checklist

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

@kirillzyusko kirillzyusko added 🤖 android Android specific 🎯 crash Library triggers a crash of the app OverKeyboardView Anything related to OverKeyboardView labels Apr 10, 2025
@kirillzyusko kirillzyusko self-assigned this Apr 10, 2025
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 10, 2025

📊 Package size report

Current size Target Size Difference
176273 bytes 176200 bytes 73 bytes 📈

@kirillzyusko kirillzyusko marked this pull request as ready for review April 11, 2025 09:37
@kirillzyusko kirillzyusko merged commit c44e7e7 into main Apr 11, 2025
16 checks passed
@kirillzyusko kirillzyusko deleted the fix/over-keyboard-view-crash branch April 11, 2025 10:06
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 OverKeyboardView Anything related to OverKeyboardView

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Android] KeyboardStickyView used with OverKeyboardView crashes app.

1 participant