Skip to content

android sdk 35 gesture handler crash No virtual method reversed() #3620

@nileshmishra1995

Description

@nileshmishra1995

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch react-native-gesture-handler@2.21.2 for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerOrchestrator.kt b/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerOrchestrator.kt
index ebcbb0d..b47423c 100644
--- a/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerOrchestrator.kt
+++ b/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerOrchestrator.kt
@@ -194,7 +194,7 @@ class GestureHandlerOrchestrator(
     }
 
     // Clear all awaiting handlers waiting for the current handler to fail
-    for (otherHandler in awaitingHandlers.c) {
+    for (otherHandler in awaitingHandlers.asReversed()) {
       if (shouldHandlerBeCancelledBy(otherHandler, handler)) {
         otherHandler.isAwaiting = false
       }
@@ -240,7 +240,7 @@ class GestureHandlerOrchestrator(
   }
 
   private fun cancelAll() {
-    for (handler in awaitingHandlers.reversed()) {
+    for (handler in awaitingHandlers.asReversed()) {
       handler.cancel()
     }
     // Copy handlers to "prepared handlers" array, because the list of active handlers can change
@@ -248,7 +248,7 @@ class GestureHandlerOrchestrator(
     preparedHandlers.clear()
     preparedHandlers.addAll(gestureHandlers)
 
-    for (handler in gestureHandlers.reversed()) {
+    for (handler in gestureHandlers.asReversed()) {
       handler.cancel()
     }
   }

This issue body was partially generated by patch-package.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions