Skip to content

Commit

Permalink
Prevent a Android crash from dispatchTouchEvent
Browse files Browse the repository at this point in the history
try-catch block around call which intermittently throws an IllegalArgumentException

Resolves Issues:
  -  software-mansion#1679
  -  facebook/react-native#30320
  • Loading branch information
escowart authored Oct 14, 2021
1 parent becb3a8 commit 2b192a3
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,14 @@ class RNGestureHandlerEnabledRootView : ReactRootView {
}

override fun dispatchTouchEvent(ev: MotionEvent): Boolean {
return if (gestureRootHelper?.dispatchTouchEvent(ev) == true) {
true
} else super.dispatchTouchEvent(ev)
return try {
if (gestureRootHelper?.dispatchTouchEvent(ev) == true) {
true
} else super.dispatchTouchEvent(ev)
} catch (e: IllegalArgumentException) {
e.printStackTrace()
false
}
}

/**
Expand Down

0 comments on commit 2b192a3

Please sign in to comment.