Skip to content
Merged
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 @@ -237,6 +237,9 @@ open class GestureHandler {
return localPointerId
}

val hasTrackedPointers: Boolean
get() = trackedPointersIDsCount > 0

fun startTrackingPointer(pointerId: Int) {
if (isTrackingPointer(pointerId)) {
return
Expand Down Expand Up @@ -801,10 +804,6 @@ open class GestureHandler {
protected open fun onCancel() {}
protected open fun onFail() {}

fun recordHandlerIfNotPresent() {
hostDetectorView?.recordHandlerIfNotPresent(this)
}

private fun isButtonInConfig(clickedButton: Int): Boolean {
if (mouseButton == 0) {
return clickedButton == MotionEvent.BUTTON_PRIMARY
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,15 @@ class RNGestureHandlerModule(reactContext: ReactApplicationContext?) :

registry.getHandler(handlerTag)?.let { handler ->
if (newState == GestureHandler.STATE_ACTIVE) {
// The first touch event reaches JS before the handler begins, so a handler
// that already tracks a pointer may still be UNDETERMINED here.
if (handler.hasTrackedPointers && handler.state == GestureHandler.STATE_UNDETERMINED) {
handler.begin()
}

if (handler.state != GestureHandler.STATE_BEGAN) {
Comment thread
coderabbitai[bot] marked this conversation as resolved.
// We don't allow activation of gestures which haven't received any touches
return
}
handler.recordHandlerIfNotPresent()
}

when (newState) {
Expand Down
Loading