react-native-gesture-handler 2.30.0-20251127-78c9ed7d6 → 2.30.0-20251201-235746986
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandler.kt +2 -4
- package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerOrchestrator.kt +4 -9
- package/android/src/main/java/com/swmansion/gesturehandler/react/Extensions.kt +5 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootView.kt +1 -1
- package/package.json +1 -1
|
@@ -20,6 +20,7 @@ import com.swmansion.gesturehandler.BuildConfig
|
|
|
20
20
|
import com.swmansion.gesturehandler.RNSVGHitTester
|
|
21
21
|
import com.swmansion.gesturehandler.react.RNGestureHandlerTouchEvent
|
|
22
22
|
import com.swmansion.gesturehandler.react.eventbuilders.GestureHandlerEventDataBuilder
|
|
23
|
+
import com.swmansion.gesturehandler.react.isHoverAction
|
|
23
24
|
import java.lang.IllegalStateException
|
|
24
25
|
import java.util.*
|
|
25
26
|
|
|
@@ -385,10 +386,7 @@ open class GestureHandler {
|
|
|
385
386
|
setPointerType(sourceEvent)
|
|
386
387
|
}
|
|
387
388
|
|
|
388
|
-
if (sourceEvent.
|
|
389
|
-
sourceEvent.action == MotionEvent.ACTION_HOVER_MOVE ||
|
|
390
|
-
sourceEvent.action == MotionEvent.ACTION_HOVER_EXIT
|
|
391
|
-
) {
|
|
389
|
+
if (sourceEvent.isHoverAction()) {
|
|
392
390
|
onHandleHover(adaptedTransformedEvent, adaptedSourceEvent)
|
|
393
391
|
} else {
|
|
394
392
|
onHandle(adaptedTransformedEvent, adaptedSourceEvent)
|
package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerOrchestrator.kt
CHANGED
|
@@ -9,6 +9,7 @@ import android.widget.EditText
|
|
|
9
9
|
import com.facebook.react.uimanager.RootView
|
|
10
10
|
import com.swmansion.gesturehandler.react.RNGestureHandlerRootHelper
|
|
11
11
|
import com.swmansion.gesturehandler.react.RNGestureHandlerRootView
|
|
12
|
+
import com.swmansion.gesturehandler.react.isHoverAction
|
|
12
13
|
import java.util.*
|
|
13
14
|
|
|
14
15
|
class GestureHandlerOrchestrator(
|
|
@@ -517,18 +518,12 @@ class GestureHandlerOrchestrator(
|
|
|
517
518
|
// There's only one exception - RootViewGestureHandler. TalkBack uses hover events,
|
|
518
519
|
// so we need to pass them into RootViewGestureHandler, otherwise press and hold
|
|
519
520
|
// gesture stops working correctly (see https://github.com/software-mansion/react-native-gesture-handler/issues/3407)
|
|
520
|
-
private fun shouldHandlerSkipHoverEvents(handler: GestureHandler,
|
|
521
|
+
private fun shouldHandlerSkipHoverEvents(handler: GestureHandler, event: MotionEvent): Boolean {
|
|
521
522
|
val shouldSkipHoverEvents =
|
|
522
523
|
handler !is HoverGestureHandler &&
|
|
523
524
|
handler !is RNGestureHandlerRootHelper.RootViewGestureHandler
|
|
524
525
|
|
|
525
|
-
return shouldSkipHoverEvents &&
|
|
526
|
-
action in
|
|
527
|
-
listOf(
|
|
528
|
-
MotionEvent.ACTION_HOVER_EXIT,
|
|
529
|
-
MotionEvent.ACTION_HOVER_ENTER,
|
|
530
|
-
MotionEvent.ACTION_HOVER_MOVE,
|
|
531
|
-
)
|
|
526
|
+
return shouldSkipHoverEvents && event.isHoverAction()
|
|
532
527
|
}
|
|
533
528
|
|
|
534
529
|
private fun recordViewHandlersForPointer(
|
|
@@ -546,7 +541,7 @@ class GestureHandlerOrchestrator(
|
|
|
546
541
|
continue
|
|
547
542
|
}
|
|
548
543
|
|
|
549
|
-
if (shouldHandlerSkipHoverEvents(handler, event
|
|
544
|
+
if (shouldHandlerSkipHoverEvents(handler, event)) {
|
|
550
545
|
continue
|
|
551
546
|
}
|
|
552
547
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
package com.swmansion.gesturehandler.react
|
|
2
2
|
|
|
3
3
|
import android.content.Context
|
|
4
|
+
import android.view.MotionEvent
|
|
4
5
|
import android.view.accessibility.AccessibilityManager
|
|
5
6
|
import com.facebook.react.bridge.ReactContext
|
|
6
7
|
import com.facebook.react.modules.core.DeviceEventManagerModule
|
|
@@ -14,3 +15,7 @@ val ReactContext.UIManager: UIManagerModule
|
|
|
14
15
|
|
|
15
16
|
fun Context.isScreenReaderOn() =
|
|
16
17
|
(getSystemService(Context.ACCESSIBILITY_SERVICE) as AccessibilityManager).isTouchExplorationEnabled
|
|
18
|
+
|
|
19
|
+
fun MotionEvent.isHoverAction(): Boolean = action == MotionEvent.ACTION_HOVER_MOVE ||
|
|
20
|
+
action == MotionEvent.ACTION_HOVER_ENTER ||
|
|
21
|
+
action == MotionEvent.ACTION_HOVER_EXIT
|
package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootView.kt
CHANGED
|
@@ -41,7 +41,7 @@ class RNGestureHandlerRootView(context: Context?) : ReactViewGroup(context) {
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
override fun dispatchGenericMotionEvent(ev: MotionEvent) =
|
|
44
|
-
if (rootViewEnabled && rootHelper!!.dispatchTouchEvent(ev)) {
|
|
44
|
+
if (rootViewEnabled && ev.isHoverAction() && rootHelper!!.dispatchTouchEvent(ev)) {
|
|
45
45
|
true
|
|
46
46
|
} else {
|
|
47
47
|
super.dispatchGenericMotionEvent(ev)
|
package/package.json
CHANGED