From 703fd3a96cf8a7703bd60af78fc03e8efb008391 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Bert?= <63123542+m-bert@users.noreply.github.com> Date: Mon, 18 Sep 2023 11:27:05 +0200 Subject: [PATCH] Fix ripple effect staying after cancellation (#2586) ## Description Sometimes when our `Button` (like `BaseButton`) is cancelled, it gets stuck at ripple animation. This may also prevent other components form receiving events, until the button will be pressed again (which will release it). This PR changes behavior after receiving `ACTION_CANCEL`, so that buttons don't get stuck anymore. Fixes #2585 ## Test plan Tested on example from [issue](https://github.com/software-mansion/react-native-gesture-handler/issues/2585) and `NestedButtons` example from our example app. --- .../gesturehandler/react/RNGestureHandlerButtonViewManager.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.kt b/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.kt index bf574c66ba..3aa19f34d6 100644 --- a/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.kt +++ b/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.kt @@ -174,6 +174,7 @@ class RNGestureHandlerButtonViewManager : ViewGroupManager(), R override fun onTouchEvent(event: MotionEvent): Boolean { if (event.action == MotionEvent.ACTION_CANCEL) { tryFreeingResponder() + return super.onTouchEvent(event) } val eventTime = event.eventTime