fix: OverKeyboardView crash#913
Merged
kirillzyusko merged 2 commits intomainfrom Apr 11, 2025
Merged
Conversation
Contributor
📊 Package size report
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📜 Description
Wrapped touch events in
try/catch.💡 Motivation and Context
The problem stems from the fact, that we are trying to cast
ViewRootImpltoViewGroup(viewrootimpl cannot be cast to android.view.viewgroup). Basically it happens when touch gets propagated untilRootViewand wasn't handled earlier. Such thing can happen when:OverKeyboardView(fixed in feat:OverKeyboardViewwith customShadowNode#863)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
handleTouchEventcalls insidetry/catchblock 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