Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -366,9 +366,17 @@ class GestureHandlerOrchestrator(
}

/**
* Cancels all handlers created using API v1 and v2
* Cancels the handlers that lose to a native view taking the touch lock: the ones created using
* API v1 and v2, and the [NativeViewGestureHandler] a button manages for itself.
*
* The button's handler is attached with [GestureHandler.ACTION_TYPE_NONE] - it dispatches its
* events natively rather than through an action - so an action type check alone leaves it
* running. It has to be cancelled here as well, or a touch that a native view claims still ends
* the button handler and fires a press. The root view's own handler shares that action type and
* must keep running, hence the type check rather than a plain [GestureHandler.ACTION_TYPE_NONE]
* one.
Comment on lines +375 to +377
*/
fun cancelAllLegacyHandlers() {
fun cancelHandlersLosingToNativeGesture() {
val handlersToProcess = obtainHandlerList()
handlersToProcess.addAll(gestureHandlers)

Expand All @@ -377,7 +385,8 @@ class GestureHandlerOrchestrator(
if (it.actionType == GestureHandler.ACTION_TYPE_JS_FUNCTION_OLD_API ||
it.actionType == GestureHandler.ACTION_TYPE_JS_FUNCTION_NEW_API ||
it.actionType == GestureHandler.ACTION_TYPE_REANIMATED_WORKLET ||
it.actionType == GestureHandler.ACTION_TYPE_NATIVE_ANIMATED_EVENT
it.actionType == GestureHandler.ACTION_TYPE_NATIVE_ANIMATED_EVENT ||
(it is NativeViewGestureHandler && it.actionType == GestureHandler.ACTION_TYPE_NONE)
) {
it.cancel()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class RNGestureHandlerRootHelper(private val context: ReactContext, wrappedView:
if (orchestrator != null && !passingTouch) {
// if we are in the process of delivering touch events via GH orchestrator, we don't want to
// treat it as a native gesture capturing the lock
orchestrator.cancelAllLegacyHandlers()
orchestrator.cancelHandlersLosingToNativeGesture()
}
}

Expand Down
Loading