You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## 📜 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:
- view is not fully laid out but it already handles a touch;
- view is not stretched to full screen and you touch area that doesn't
belong to `OverKeyboardView` (fixed in
#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
<!-- High level overview of important changes -->
<!-- For example: fixed status bar manipulation; added new types
declarations; -->
<!-- If your changes don't affect one of platform/language below - then
remove this platform/language -->
### 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):
https://github.com/user-attachments/assets/9ffa684d-ddb7-46e5-b143-d526ab680d28
## 📝 Checklist
- [x] CI successfully passed
- [x] I added new mocks and corresponding unit-tests if library API was
changed
0 commit comments