mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Fix crash in TouchEvent when initialized with scroll MotionEvent action (#48723)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/48723 ## Changelog: [Internal] - In certain scenarios `TouchEvent` can be initialized with "unexpected" event actions, such as `ACTION_SCROLL`. This caused an exception , even though such scenarios may be legitimate. Reviewed By: javache Differential Revision: D68265040 fbshipit-source-id: d31881e03d9110bb4f6af38548a4f73a41c54d2b
This commit is contained in:
committed by
Facebook GitHub Bot
parent
0e6cb590ec
commit
918638c1be
+2
-1
@@ -64,7 +64,8 @@ public class TouchEvent private constructor() : Event<TouchEvent>() {
|
||||
coalescingKey = touchEventCoalescingKeyHelper.getCoalescingKey(gestureStartTime)
|
||||
MotionEvent.ACTION_CANCEL ->
|
||||
touchEventCoalescingKeyHelper.removeCoalescingKey(gestureStartTime)
|
||||
else -> throw RuntimeException("Unhandled MotionEvent action: $action")
|
||||
else ->
|
||||
Unit // Passthrough for other actions (such as ACTION_SCROLL), coalescing is not applied
|
||||
}
|
||||
|
||||
motionEvent = MotionEvent.obtain(motionEventToCopy)
|
||||
|
||||
Reference in New Issue
Block a user