react-native-gesture-handler 2.21.2 → 2.22.0-rc.1
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +1 -3
- package/android/build.gradle +10 -0
- package/android/paper/src/main/java/com/facebook/react/viewmanagers/RNGestureHandlerButtonManagerDelegate.java +3 -2
- package/android/paper/src/main/java/com/facebook/react/viewmanagers/RNGestureHandlerRootViewManagerDelegate.java +3 -2
- package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandler.kt +16 -0
- package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerOrchestrator.kt +1 -1
- package/android/src/main/java/com/swmansion/gesturehandler/core/NativeViewGestureHandler.kt +45 -8
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.kt +18 -0
- package/apple/Handlers/RNFlingHandler.m +0 -1
- package/apple/Handlers/RNForceTouchHandler.m +0 -1
- package/apple/Handlers/RNLongPressHandler.m +0 -1
- package/apple/Handlers/RNManualHandler.m +0 -1
- package/apple/Handlers/RNPanHandler.m +0 -3
- package/apple/Handlers/RNPinchHandler.m +0 -1
- package/apple/Handlers/RNRotationHandler.m +0 -1
- package/apple/Handlers/RNTapHandler.m +0 -1
- package/apple/RNGestureHandlerButton.h +1 -0
- package/apple/RNGestureHandlerButton.mm +51 -0
- package/apple/RNGestureHandlerManager.mm +6 -1
- package/apple/RNManualActivationRecognizer.m +1 -0
- package/lib/commonjs/ActionType.js.map +1 -1
- package/lib/commonjs/Directions.js.map +1 -1
- package/lib/commonjs/EnableNewWebImplementation.js +14 -1
- package/lib/commonjs/EnableNewWebImplementation.js.map +1 -1
- package/lib/commonjs/State.js.map +1 -1
- package/lib/commonjs/TouchEventType.js.map +1 -1
- package/lib/commonjs/components/Pressable/Pressable.js +1 -1
- package/lib/commonjs/components/Pressable/Pressable.js.map +1 -1
- package/lib/commonjs/components/ReanimatedSwipeable.js.map +1 -1
- package/lib/commonjs/components/Swipeable.js.map +1 -1
- package/lib/commonjs/components/Text.js +61 -0
- package/lib/commonjs/components/Text.js.map +1 -0
- package/lib/commonjs/components/touchables/GenericTouchable.js.map +1 -1
- package/lib/commonjs/getShadowNodeFromRef.js +10 -2
- package/lib/commonjs/getShadowNodeFromRef.js.map +1 -1
- package/lib/commonjs/ghQueueMicrotask.js.map +1 -1
- package/lib/commonjs/handlers/createHandler.js +12 -0
- package/lib/commonjs/handlers/createHandler.js.map +1 -1
- package/lib/commonjs/handlers/gestureHandlerCommon.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/attachHandlers.js +4 -0
- package/lib/commonjs/handlers/gestures/GestureDetector/attachHandlers.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/dropHandlers.js +4 -0
- package/lib/commonjs/handlers/gestures/GestureDetector/dropHandlers.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/index.js +3 -0
- package/lib/commonjs/handlers/gestures/GestureDetector/index.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/useMountReactions.js +48 -0
- package/lib/commonjs/handlers/gestures/GestureDetector/useMountReactions.js.map +1 -0
- package/lib/commonjs/handlers/gestures/gesture.js.map +1 -1
- package/lib/commonjs/handlers/utils.js +1 -0
- package/lib/commonjs/handlers/utils.js.map +1 -1
- package/lib/commonjs/index.js +8 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/jestUtils/jestUtils.js.map +1 -1
- package/lib/commonjs/mountRegistry.js +49 -0
- package/lib/commonjs/mountRegistry.js.map +1 -0
- package/lib/commonjs/web/detectors/ScaleGestureDetector.js.map +1 -1
- package/lib/commonjs/web/handlers/FlingGestureHandler.js +0 -4
- package/lib/commonjs/web/handlers/FlingGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/GestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/HoverGestureHandler.js +0 -14
- package/lib/commonjs/web/handlers/HoverGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/ManualGestureHandler.js +0 -14
- package/lib/commonjs/web/handlers/ManualGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/NativeViewGestureHandler.js +3 -5
- package/lib/commonjs/web/handlers/NativeViewGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/PanGestureHandler.js +0 -4
- package/lib/commonjs/web/handlers/PanGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/PinchGestureHandler.js +0 -10
- package/lib/commonjs/web/handlers/PinchGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/RotationGestureHandler.js +0 -14
- package/lib/commonjs/web/handlers/RotationGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/TapGestureHandler.js +0 -4
- package/lib/commonjs/web/handlers/TapGestureHandler.js.map +1 -1
- package/lib/commonjs/web/tools/GestureHandlerWebDelegate.js.map +1 -1
- package/lib/commonjs/web_hammer/GestureHandler.js.map +1 -1
- package/lib/commonjs/web_hammer/PressGestureHandler.js.map +1 -1
- package/lib/module/ActionType.js.map +1 -1
- package/lib/module/Directions.js.map +1 -1
- package/lib/module/EnableNewWebImplementation.js +14 -1
- package/lib/module/EnableNewWebImplementation.js.map +1 -1
- package/lib/module/State.js.map +1 -1
- package/lib/module/TouchEventType.js.map +1 -1
- package/lib/module/components/Pressable/Pressable.js +1 -1
- package/lib/module/components/Pressable/Pressable.js.map +1 -1
- package/lib/module/components/ReanimatedSwipeable.js.map +1 -1
- package/lib/module/components/Swipeable.js.map +1 -1
- package/lib/module/components/Text.js +44 -0
- package/lib/module/components/Text.js.map +1 -0
- package/lib/module/components/touchables/GenericTouchable.js.map +1 -1
- package/lib/module/getShadowNodeFromRef.js +10 -2
- package/lib/module/getShadowNodeFromRef.js.map +1 -1
- package/lib/module/ghQueueMicrotask.js.map +1 -1
- package/lib/module/handlers/createHandler.js +11 -0
- package/lib/module/handlers/createHandler.js.map +1 -1
- package/lib/module/handlers/gestureHandlerCommon.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector/attachHandlers.js +3 -0
- package/lib/module/handlers/gestures/GestureDetector/attachHandlers.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector/dropHandlers.js +2 -0
- package/lib/module/handlers/gestures/GestureDetector/dropHandlers.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector/index.js +2 -0
- package/lib/module/handlers/gestures/GestureDetector/index.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector/useMountReactions.js +39 -0
- package/lib/module/handlers/gestures/GestureDetector/useMountReactions.js.map +1 -0
- package/lib/module/handlers/gestures/gesture.js.map +1 -1
- package/lib/module/handlers/utils.js +1 -3
- package/lib/module/handlers/utils.js.map +1 -1
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/jestUtils/jestUtils.js.map +1 -1
- package/lib/module/mountRegistry.js +40 -0
- package/lib/module/mountRegistry.js.map +1 -0
- package/lib/module/web/detectors/ScaleGestureDetector.js.map +1 -1
- package/lib/module/web/handlers/FlingGestureHandler.js +0 -4
- package/lib/module/web/handlers/FlingGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/GestureHandler.js.map +1 -1
- package/lib/module/web/handlers/HoverGestureHandler.js +0 -14
- package/lib/module/web/handlers/HoverGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/ManualGestureHandler.js +0 -14
- package/lib/module/web/handlers/ManualGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/NativeViewGestureHandler.js +3 -5
- package/lib/module/web/handlers/NativeViewGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/PanGestureHandler.js +0 -4
- package/lib/module/web/handlers/PanGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/PinchGestureHandler.js +0 -10
- package/lib/module/web/handlers/PinchGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/RotationGestureHandler.js +0 -14
- package/lib/module/web/handlers/RotationGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/TapGestureHandler.js +0 -4
- package/lib/module/web/handlers/TapGestureHandler.js.map +1 -1
- package/lib/module/web/tools/GestureHandlerWebDelegate.js.map +1 -1
- package/lib/module/web_hammer/GestureHandler.js.map +1 -1
- package/lib/module/web_hammer/PressGestureHandler.js.map +1 -1
- package/lib/typescript/ActionType.d.ts +1 -1
- package/lib/typescript/Directions.d.ts +2 -2
- package/lib/typescript/EnableNewWebImplementation.d.ts +6 -0
- package/lib/typescript/State.d.ts +1 -1
- package/lib/typescript/TouchEventType.d.ts +1 -1
- package/lib/typescript/components/GestureButtonsProps.d.ts +2 -2
- package/lib/typescript/components/Text.d.ts +4 -0
- package/lib/typescript/components/touchables/GenericTouchable.d.ts +1 -1
- package/lib/typescript/handlers/GestureHandlerEventPayload.d.ts +2 -2
- package/lib/typescript/handlers/gestures/GestureDetector/useMountReactions.d.ts +2 -0
- package/lib/typescript/handlers/gestures/gesture.d.ts +1 -1
- package/lib/typescript/handlers/utils.d.ts +1 -0
- package/lib/typescript/index.d.ts +1 -0
- package/lib/typescript/mocks.d.ts +3 -3
- package/lib/typescript/mountRegistry.d.ts +17 -0
- package/lib/typescript/web/handlers/FlingGestureHandler.d.ts +0 -2
- package/lib/typescript/web/handlers/HoverGestureHandler.d.ts +1 -4
- package/lib/typescript/web/handlers/ManualGestureHandler.d.ts +1 -4
- package/lib/typescript/web/handlers/NativeViewGestureHandler.d.ts +0 -1
- package/lib/typescript/web/handlers/PanGestureHandler.d.ts +0 -2
- package/lib/typescript/web/handlers/PinchGestureHandler.d.ts +1 -2
- package/lib/typescript/web/handlers/RotationGestureHandler.d.ts +1 -3
- package/lib/typescript/web/handlers/TapGestureHandler.d.ts +0 -2
- package/package.json +16 -17
- package/src/ActionType.ts +1 -1
- package/src/Directions.ts +2 -2
- package/src/EnableNewWebImplementation.ts +18 -0
- package/src/State.ts +1 -1
- package/src/TouchEventType.ts +2 -1
- package/src/components/GestureButtonsProps.ts +4 -2
- package/src/components/Pressable/Pressable.tsx +3 -3
- package/src/components/ReanimatedSwipeable.tsx +8 -8
- package/src/components/Swipeable.tsx +4 -4
- package/src/components/Text.tsx +60 -0
- package/src/components/touchables/GenericTouchable.tsx +1 -1
- package/src/getShadowNodeFromRef.ts +8 -2
- package/src/ghQueueMicrotask.ts +2 -2
- package/src/handlers/GestureHandlerEventPayload.ts +2 -2
- package/src/handlers/createHandler.tsx +14 -1
- package/src/handlers/gestureHandlerCommon.ts +3 -3
- package/src/handlers/gestures/GestureDetector/attachHandlers.ts +3 -0
- package/src/handlers/gestures/GestureDetector/dropHandlers.ts +3 -0
- package/src/handlers/gestures/GestureDetector/index.tsx +3 -0
- package/src/handlers/gestures/GestureDetector/useMountReactions.ts +51 -0
- package/src/handlers/gestures/gesture.ts +3 -3
- package/src/handlers/utils.ts +2 -1
- package/src/index.ts +1 -0
- package/src/jestUtils/jestUtils.ts +10 -12
- package/src/mountRegistry.ts +51 -0
- package/src/web/detectors/ScaleGestureDetector.ts +1 -1
- package/src/web/handlers/FlingGestureHandler.ts +0 -4
- package/src/web/handlers/GestureHandler.ts +1 -3
- package/src/web/handlers/HoverGestureHandler.ts +1 -9
- package/src/web/handlers/ManualGestureHandler.ts +1 -9
- package/src/web/handlers/NativeViewGestureHandler.ts +5 -5
- package/src/web/handlers/PanGestureHandler.ts +0 -4
- package/src/web/handlers/PinchGestureHandler.ts +1 -5
- package/src/web/handlers/RotationGestureHandler.ts +1 -9
- package/src/web/handlers/TapGestureHandler.ts +0 -4
- package/src/web/tools/GestureHandlerWebDelegate.ts +4 -4
- package/src/web_hammer/GestureHandler.ts +1 -1
- package/src/web_hammer/PressGestureHandler.ts +7 -4
- package/android/src/main/java/com/swmansion/gesturehandler/RNGestureHandlerPackage.kt +0 -86
package/README.md
CHANGED
@@ -37,14 +37,12 @@ You will need to have an Android or iOS device or emulator connected.
|
|
37
37
|
|
38
38
|
| version | react-native version |
|
39
39
|
| ------- | -------------------- |
|
40
|
+
| 2.21.0+ | 0.74.0+ |
|
40
41
|
| 2.18.0+ | 0.73.0+ |
|
41
42
|
| 2.16.0+ | 0.68.0+ |
|
42
43
|
| 2.14.0+ | 0.67.0+ |
|
43
44
|
| 2.10.0+ | 0.64.0+ |
|
44
45
|
| 2.0.0+ | 0.63.0+ |
|
45
|
-
| 1.4.0+ | 0.60.0+ |
|
46
|
-
| 1.1.0+ | 0.57.2+ |
|
47
|
-
| <1.1.0 | 0.50.0+ |
|
48
46
|
|
49
47
|
It may be possible to use newer versions of react-native-gesture-handler on React Native with version <= 0.59 by reverse Jetifying.
|
50
48
|
Read more on that here <https://github.com/mikehardy/jetifier#to-reverse-jetify--convert-node_modules-dependencies-to-support-libraries>
|
package/android/build.gradle
CHANGED
@@ -153,6 +153,7 @@ android {
|
|
153
153
|
exclude "**/libreact_render*.so"
|
154
154
|
exclude "**/libreactnative.so"
|
155
155
|
exclude "**/libjsi.so"
|
156
|
+
exclude "**/libc++_shared.so"
|
156
157
|
}
|
157
158
|
|
158
159
|
sourceSets.main {
|
@@ -173,6 +174,15 @@ android {
|
|
173
174
|
// codegen turned off
|
174
175
|
srcDirs += 'paper/src/main/java'
|
175
176
|
}
|
177
|
+
|
178
|
+
if (REACT_NATIVE_MINOR_VERSION >= 77) {
|
179
|
+
// With RN 0.77, ViewManager related functions in the package has different signatures as they
|
180
|
+
// are no longer nullable
|
181
|
+
srcDirs += 'package77/src/main/java'
|
182
|
+
} else {
|
183
|
+
// It's safe to delete this block once we drop support for RN 0.76
|
184
|
+
srcDirs += 'packageDeprecated/src/main/java'
|
185
|
+
}
|
176
186
|
}
|
177
187
|
}
|
178
188
|
|
@@ -12,10 +12,11 @@ package com.facebook.react.viewmanagers;
|
|
12
12
|
import android.view.View;
|
13
13
|
import androidx.annotation.Nullable;
|
14
14
|
import com.facebook.react.bridge.ColorPropConverter;
|
15
|
+
import com.facebook.react.uimanager.BaseViewManager;
|
15
16
|
import com.facebook.react.uimanager.BaseViewManagerDelegate;
|
16
|
-
import com.facebook.react.uimanager.
|
17
|
+
import com.facebook.react.uimanager.LayoutShadowNode;
|
17
18
|
|
18
|
-
public class RNGestureHandlerButtonManagerDelegate<T extends View, U extends
|
19
|
+
public class RNGestureHandlerButtonManagerDelegate<T extends View, U extends BaseViewManager<T, ? extends LayoutShadowNode> & RNGestureHandlerButtonManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
|
19
20
|
public RNGestureHandlerButtonManagerDelegate(U viewManager) {
|
20
21
|
super(viewManager);
|
21
22
|
}
|
@@ -11,10 +11,11 @@ package com.facebook.react.viewmanagers;
|
|
11
11
|
|
12
12
|
import android.view.View;
|
13
13
|
import androidx.annotation.Nullable;
|
14
|
+
import com.facebook.react.uimanager.BaseViewManager;
|
14
15
|
import com.facebook.react.uimanager.BaseViewManagerDelegate;
|
15
|
-
import com.facebook.react.uimanager.
|
16
|
+
import com.facebook.react.uimanager.LayoutShadowNode;
|
16
17
|
|
17
|
-
public class RNGestureHandlerRootViewManagerDelegate<T extends View, U extends
|
18
|
+
public class RNGestureHandlerRootViewManagerDelegate<T extends View, U extends BaseViewManager<T, ? extends LayoutShadowNode> & RNGestureHandlerRootViewManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
|
18
19
|
public RNGestureHandlerRootViewManagerDelegate(U viewManager) {
|
19
20
|
super(viewManager);
|
20
21
|
}
|
@@ -684,6 +684,22 @@ open class GestureHandler<ConcreteGestureHandlerT : GestureHandler<ConcreteGestu
|
|
684
684
|
}
|
685
685
|
}
|
686
686
|
|
687
|
+
/*
|
688
|
+
* Returns true if the view this handler is attached to is a descendant of the view the other handler
|
689
|
+
* is attached to and false otherwise.
|
690
|
+
*/
|
691
|
+
fun isDescendantOf(of: GestureHandler<*>): Boolean {
|
692
|
+
var view = this.view?.parent as? View
|
693
|
+
while (view != null) {
|
694
|
+
if (view == of.view) {
|
695
|
+
return true
|
696
|
+
}
|
697
|
+
|
698
|
+
view = view.parent as? View
|
699
|
+
}
|
700
|
+
return false
|
701
|
+
}
|
702
|
+
|
687
703
|
// responsible for resetting the state of handler upon activation (may be called more than once
|
688
704
|
// if the handler is waiting for failure of other one)
|
689
705
|
open fun resetProgress() {}
|
package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerOrchestrator.kt
CHANGED
@@ -89,7 +89,7 @@ class GestureHandlerOrchestrator(
|
|
89
89
|
gestureHandlers.any { shouldHandlerWaitForOther(handler, it) && it.state == GestureHandler.STATE_END }
|
90
90
|
|
91
91
|
private fun shouldBeCancelledByActiveHandler(handler: GestureHandler<*>) =
|
92
|
-
gestureHandlers.any { handler.hasCommonPointers(it) && it.state == GestureHandler.STATE_ACTIVE && !canRunSimultaneously(handler, it) }
|
92
|
+
gestureHandlers.any { handler.hasCommonPointers(it) && it.state == GestureHandler.STATE_ACTIVE && !canRunSimultaneously(handler, it) && handler.isDescendantOf(it) }
|
93
93
|
|
94
94
|
private fun tryActivate(handler: GestureHandler<*>) {
|
95
95
|
// If we are waiting for a gesture that has successfully finished, we should cancel handler
|
@@ -6,9 +6,12 @@ import android.view.View
|
|
6
6
|
import android.view.ViewConfiguration
|
7
7
|
import android.view.ViewGroup
|
8
8
|
import android.widget.ScrollView
|
9
|
+
import com.facebook.react.views.scroll.ReactHorizontalScrollView
|
9
10
|
import com.facebook.react.views.scroll.ReactScrollView
|
10
11
|
import com.facebook.react.views.swiperefresh.ReactSwipeRefreshLayout
|
12
|
+
import com.facebook.react.views.text.ReactTextView
|
11
13
|
import com.facebook.react.views.textinput.ReactEditText
|
14
|
+
import com.facebook.react.views.view.ReactViewGroup
|
12
15
|
import com.swmansion.gesturehandler.react.RNGestureHandlerButtonViewManager
|
13
16
|
import com.swmansion.gesturehandler.react.isScreenReaderOn
|
14
17
|
|
@@ -44,7 +47,11 @@ class NativeViewGestureHandler : GestureHandler<NativeViewGestureHandler>() {
|
|
44
47
|
|
45
48
|
override fun shouldRecognizeSimultaneously(handler: GestureHandler<*>): Boolean {
|
46
49
|
// if the gesture is marked by user as simultaneous with other or the hook return true
|
47
|
-
|
50
|
+
hook.shouldRecognizeSimultaneously(handler)?.let {
|
51
|
+
return@shouldRecognizeSimultaneously it
|
52
|
+
}
|
53
|
+
|
54
|
+
if (super.shouldRecognizeSimultaneously(handler)) {
|
48
55
|
return true
|
49
56
|
}
|
50
57
|
|
@@ -79,6 +86,9 @@ class NativeViewGestureHandler : GestureHandler<NativeViewGestureHandler>() {
|
|
79
86
|
is ReactEditText -> this.hook = EditTextHook(this, view)
|
80
87
|
is ReactSwipeRefreshLayout -> this.hook = SwipeRefreshLayoutHook(this, view)
|
81
88
|
is ReactScrollView -> this.hook = ScrollViewHook()
|
89
|
+
is ReactHorizontalScrollView -> this.hook = ScrollViewHook()
|
90
|
+
is ReactTextView -> this.hook = TextViewHook()
|
91
|
+
is ReactViewGroup -> this.hook = ReactViewGroupHook()
|
82
92
|
}
|
83
93
|
}
|
84
94
|
|
@@ -99,8 +109,9 @@ class NativeViewGestureHandler : GestureHandler<NativeViewGestureHandler>() {
|
|
99
109
|
if (state == STATE_UNDETERMINED && !hook.canBegin(event)) {
|
100
110
|
cancel()
|
101
111
|
} else {
|
102
|
-
|
103
|
-
|
112
|
+
hook.sendTouchEvent(view, event)
|
113
|
+
|
114
|
+
if ((state == STATE_UNDETERMINED || state == STATE_BEGAN) && hook.canActivate(view)) {
|
104
115
|
activate()
|
105
116
|
}
|
106
117
|
|
@@ -116,12 +127,12 @@ class NativeViewGestureHandler : GestureHandler<NativeViewGestureHandler>() {
|
|
116
127
|
when {
|
117
128
|
shouldActivateOnStart -> {
|
118
129
|
tryIntercept(view, event)
|
119
|
-
|
130
|
+
hook.sendTouchEvent(view, event)
|
120
131
|
activate()
|
121
132
|
}
|
122
133
|
|
123
134
|
tryIntercept(view, event) -> {
|
124
|
-
|
135
|
+
hook.sendTouchEvent(view, event)
|
125
136
|
activate()
|
126
137
|
}
|
127
138
|
|
@@ -136,7 +147,7 @@ class NativeViewGestureHandler : GestureHandler<NativeViewGestureHandler>() {
|
|
136
147
|
}
|
137
148
|
}
|
138
149
|
} else if (state == STATE_ACTIVE) {
|
139
|
-
|
150
|
+
hook.sendTouchEvent(view, event)
|
140
151
|
}
|
141
152
|
}
|
142
153
|
|
@@ -145,7 +156,7 @@ class NativeViewGestureHandler : GestureHandler<NativeViewGestureHandler>() {
|
|
145
156
|
val event = MotionEvent.obtain(time, time, MotionEvent.ACTION_CANCEL, 0f, 0f, 0).apply {
|
146
157
|
action = MotionEvent.ACTION_CANCEL
|
147
158
|
}
|
148
|
-
view
|
159
|
+
hook.sendTouchEvent(view, event)
|
149
160
|
event.recycle()
|
150
161
|
}
|
151
162
|
|
@@ -170,6 +181,11 @@ class NativeViewGestureHandler : GestureHandler<NativeViewGestureHandler>() {
|
|
170
181
|
*/
|
171
182
|
fun canBegin(event: MotionEvent) = true
|
172
183
|
|
184
|
+
/**
|
185
|
+
* Checks whether handler can activate. Used by TextViewHook.
|
186
|
+
*/
|
187
|
+
fun canActivate(view: View) = view.isPressed
|
188
|
+
|
173
189
|
/**
|
174
190
|
* Called after the gesture transitions to the END state.
|
175
191
|
*/
|
@@ -179,7 +195,7 @@ class NativeViewGestureHandler : GestureHandler<NativeViewGestureHandler>() {
|
|
179
195
|
* @return Boolean value signalling whether the gesture can be recognized simultaneously with
|
180
196
|
* other (handler). Returning false doesn't necessarily prevent it from happening.
|
181
197
|
*/
|
182
|
-
fun shouldRecognizeSimultaneously(handler: GestureHandler<*>) =
|
198
|
+
fun shouldRecognizeSimultaneously(handler: GestureHandler<*>): Boolean? = null
|
183
199
|
|
184
200
|
/**
|
185
201
|
* shouldActivateOnStart and tryIntercept have priority over this method
|
@@ -199,6 +215,19 @@ class NativeViewGestureHandler : GestureHandler<NativeViewGestureHandler>() {
|
|
199
215
|
* by this one.
|
200
216
|
*/
|
201
217
|
fun shouldCancelRootViewGestureHandlerIfNecessary() = false
|
218
|
+
|
219
|
+
/**
|
220
|
+
* Passes the event down to the underlying view using the correct method.
|
221
|
+
*/
|
222
|
+
fun sendTouchEvent(view: View?, event: MotionEvent) = view?.onTouchEvent(event)
|
223
|
+
}
|
224
|
+
|
225
|
+
private class TextViewHook() : NativeViewGestureHandlerHook {
|
226
|
+
override fun shouldRecognizeSimultaneously(handler: GestureHandler<*>) = false
|
227
|
+
|
228
|
+
// We have to explicitly check for ReactTextView, since its `isPressed` flag is not set to `true`,
|
229
|
+
// in contrast to e.g. Touchable
|
230
|
+
override fun canActivate(view: View) = view is ReactTextView
|
202
231
|
}
|
203
232
|
|
204
233
|
private class EditTextHook(
|
@@ -278,4 +307,12 @@ class NativeViewGestureHandler : GestureHandler<NativeViewGestureHandler>() {
|
|
278
307
|
private class ScrollViewHook : NativeViewGestureHandlerHook {
|
279
308
|
override fun shouldCancelRootViewGestureHandlerIfNecessary() = true
|
280
309
|
}
|
310
|
+
|
311
|
+
private class ReactViewGroupHook : NativeViewGestureHandlerHook {
|
312
|
+
// There are cases where a native component is wrapped with a `ReactViewGroup` (the component is rendered
|
313
|
+
// inside a `<View />` component in JS). In such cases, calling `onTouchEvent` wouldn't work as those are
|
314
|
+
// ignored by the wrapper view. Instead `dispatchTouchEvent` can be used, which causes the view to dispatch
|
315
|
+
// the event to its children.
|
316
|
+
override fun sendTouchEvent(view: View?, event: MotionEvent) = view?.dispatchTouchEvent(event)
|
317
|
+
}
|
281
318
|
}
|
@@ -22,7 +22,9 @@ import android.view.View
|
|
22
22
|
import android.view.View.OnClickListener
|
23
23
|
import android.view.ViewGroup
|
24
24
|
import android.view.ViewParent
|
25
|
+
import android.view.accessibility.AccessibilityNodeInfo
|
25
26
|
import androidx.core.view.children
|
27
|
+
import com.facebook.react.R
|
26
28
|
import com.facebook.react.module.annotations.ReactModule
|
27
29
|
import com.facebook.react.uimanager.PixelUtil
|
28
30
|
import com.facebook.react.uimanager.ThemedReactContext
|
@@ -124,6 +126,8 @@ class RNGestureHandlerButtonViewManager : ViewGroupManager<ButtonViewGroup>(), R
|
|
124
126
|
}
|
125
127
|
|
126
128
|
override fun onAfterUpdateTransaction(view: ButtonViewGroup) {
|
129
|
+
super.onAfterUpdateTransaction(view)
|
130
|
+
|
127
131
|
view.updateBackground()
|
128
132
|
}
|
129
133
|
|
@@ -241,6 +245,20 @@ class RNGestureHandlerButtonViewManager : ViewGroupManager<ButtonViewGroup>(), R
|
|
241
245
|
_backgroundColor = color
|
242
246
|
}
|
243
247
|
|
248
|
+
override fun onInitializeAccessibilityNodeInfo(info: AccessibilityNodeInfo) {
|
249
|
+
super.onInitializeAccessibilityNodeInfo(info)
|
250
|
+
|
251
|
+
// Expose the testID prop as the resource-id name of the view. Black-box E2E/UI testing
|
252
|
+
// frameworks, which interact with the UI through the accessibility framework, do not have
|
253
|
+
// access to view tags. This allows developers/testers to avoid polluting the
|
254
|
+
// content-description with test identifiers.
|
255
|
+
val testId = super.getTag(R.id.react_test_id)
|
256
|
+
|
257
|
+
if (testId is String) {
|
258
|
+
info.setViewIdResourceName(testId)
|
259
|
+
}
|
260
|
+
}
|
261
|
+
|
244
262
|
override fun onInterceptTouchEvent(ev: MotionEvent): Boolean {
|
245
263
|
if (super.onInterceptTouchEvent(ev)) {
|
246
264
|
return true
|
@@ -60,7 +60,6 @@
|
|
60
60
|
_lastPoint = [[[touches allObjects] objectAtIndex:0] locationInView:_gestureHandler.recognizer.view];
|
61
61
|
[super touchesCancelled:touches withEvent:event];
|
62
62
|
[_gestureHandler.pointerTracker touchesCancelled:touches withEvent:event];
|
63
|
-
[self reset];
|
64
63
|
}
|
65
64
|
|
66
65
|
- (void)triggerAction
|
@@ -115,7 +115,6 @@ static const BOOL defaultFeedbackOnActivation = NO;
|
|
115
115
|
{
|
116
116
|
[super touchesCancelled:touches withEvent:event];
|
117
117
|
[_gestureHandler.pointerTracker touchesCancelled:touches withEvent:event];
|
118
|
-
[self reset];
|
119
118
|
}
|
120
119
|
|
121
120
|
- (void)handleForceWithTouches:(NSSet<RNGHUITouch *> *)touches
|
@@ -196,12 +196,9 @@
|
|
196
196
|
- (void)interactionsCancelled:(NSSet *)touches withEvent:(UIEvent *)event
|
197
197
|
{
|
198
198
|
[_gestureHandler.pointerTracker touchesCancelled:touches withEvent:event];
|
199
|
-
|
200
199
|
#if !TARGET_OS_TV && !TARGET_OS_OSX
|
201
200
|
[self tryUpdateStylusData:event];
|
202
201
|
#endif
|
203
|
-
|
204
|
-
[self reset];
|
205
202
|
}
|
206
203
|
|
207
204
|
#if TARGET_OS_OSX
|
@@ -26,6 +26,7 @@
|
|
26
26
|
* Insets used when hit testing inside this view.
|
27
27
|
*/
|
28
28
|
@property (nonatomic, assign) UIEdgeInsets hitTestEdgeInsets;
|
29
|
+
@property (nonatomic, assign) CGFloat borderRadius;
|
29
30
|
@property (nonatomic) BOOL userEnabled;
|
30
31
|
|
31
32
|
#if TARGET_OS_OSX && RCT_NEW_ARCH_ENABLED
|
@@ -89,6 +89,57 @@
|
|
89
89
|
}
|
90
90
|
return inner;
|
91
91
|
}
|
92
|
+
|
93
|
+
- (void)setBorderRadius:(CGFloat)radius
|
94
|
+
{
|
95
|
+
if (_borderRadius == radius) {
|
96
|
+
return;
|
97
|
+
}
|
98
|
+
|
99
|
+
_borderRadius = radius;
|
100
|
+
[self.layer setNeedsDisplay];
|
101
|
+
}
|
102
|
+
|
103
|
+
- (void)displayLayer:(CALayer *)layer
|
104
|
+
{
|
105
|
+
if (CGSizeEqualToSize(layer.bounds.size, CGSizeZero)) {
|
106
|
+
return;
|
107
|
+
}
|
108
|
+
|
109
|
+
const CGFloat radius = MAX(0, _borderRadius);
|
110
|
+
const CGSize size = self.bounds.size;
|
111
|
+
const CGFloat scaleFactor = RCTZeroIfNaN(MIN(1, size.width / (2 * radius)));
|
112
|
+
const CGFloat currentBorderRadius = radius * scaleFactor;
|
113
|
+
layer.cornerRadius = currentBorderRadius;
|
114
|
+
}
|
115
|
+
|
116
|
+
- (NSString *)accessibilityLabel
|
117
|
+
{
|
118
|
+
NSString *label = super.accessibilityLabel;
|
119
|
+
if (label) {
|
120
|
+
return label;
|
121
|
+
}
|
122
|
+
return RNGHRecursiveAccessibilityLabel(self);
|
123
|
+
}
|
124
|
+
|
125
|
+
// Vendored from RCTView.m to infer accessibility label from children
|
126
|
+
static NSString *RNGHRecursiveAccessibilityLabel(UIView *view)
|
127
|
+
{
|
128
|
+
NSMutableString *str = [NSMutableString stringWithString:@""];
|
129
|
+
for (UIView *subview in view.subviews) {
|
130
|
+
NSString *label = subview.accessibilityLabel;
|
131
|
+
if (!label) {
|
132
|
+
label = RNGHRecursiveAccessibilityLabel(subview);
|
133
|
+
}
|
134
|
+
if (label && label.length > 0) {
|
135
|
+
if (str.length > 0) {
|
136
|
+
[str appendString:@" "];
|
137
|
+
}
|
138
|
+
[str appendString:label];
|
139
|
+
}
|
140
|
+
}
|
141
|
+
return str.length == 0 ? nil : str;
|
142
|
+
}
|
92
143
|
#endif
|
93
144
|
|
94
145
|
#if TARGET_OS_OSX && RCT_NEW_ARCH_ENABLED
|
@@ -51,6 +51,7 @@ constexpr int NEW_ARCH_NUMBER_OF_ATTACH_RETRIES = 25;
|
|
51
51
|
RNGestureHandlerRegistry *_registry;
|
52
52
|
NSHashTable<RNRootViewGestureRecognizer *> *_rootViewGestureRecognizers;
|
53
53
|
NSMutableDictionary<NSNumber *, NSNumber *> *_attachRetryCounter;
|
54
|
+
NSMutableSet *_droppedHandlers;
|
54
55
|
#ifdef RCT_NEW_ARCH_ENABLED
|
55
56
|
RCTModuleRegistry *_moduleRegistry;
|
56
57
|
RCTViewRegistry *_viewRegistry;
|
@@ -90,6 +91,7 @@ constexpr int NEW_ARCH_NUMBER_OF_ATTACH_RETRIES = 25;
|
|
90
91
|
_registry = [RNGestureHandlerRegistry new];
|
91
92
|
_rootViewGestureRecognizers = [NSHashTable hashTableWithOptions:NSPointerFunctionsWeakMemory];
|
92
93
|
_attachRetryCounter = [[NSMutableDictionary alloc] init];
|
94
|
+
_droppedHandlers = [NSMutableSet set];
|
93
95
|
}
|
94
96
|
|
95
97
|
- (void)createGestureHandler:(NSString *)handlerName tag:(NSNumber *)handlerTag config:(NSDictionary *)config
|
@@ -168,7 +170,9 @@ constexpr int NEW_ARCH_NUMBER_OF_ATTACH_RETRIES = 25;
|
|
168
170
|
[_attachRetryCounter setObject:counter forKey:viewTag];
|
169
171
|
|
170
172
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.1 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
|
171
|
-
[
|
173
|
+
if (![_droppedHandlers containsObject:handlerTag]) {
|
174
|
+
[self attachGestureHandler:handlerTag toViewWithTag:viewTag withActionType:actionType];
|
175
|
+
}
|
172
176
|
});
|
173
177
|
}
|
174
178
|
|
@@ -205,6 +209,7 @@ constexpr int NEW_ARCH_NUMBER_OF_ATTACH_RETRIES = 25;
|
|
205
209
|
- (void)dropGestureHandler:(NSNumber *)handlerTag
|
206
210
|
{
|
207
211
|
[_registry dropHandlerWithTag:handlerTag];
|
212
|
+
[_droppedHandlers addObject:handlerTag];
|
208
213
|
}
|
209
214
|
|
210
215
|
- (void)dropAllGestureHandlers
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["ActionType.ts"],"names":["ActionType","REANIMATED_WORKLET","NATIVE_ANIMATED_EVENT","JS_FUNCTION_OLD_API","JS_FUNCTION_NEW_API"],"mappings":";;;;;;AAAO,MAAMA,UAAU,GAAG;AACxBC,EAAAA,kBAAkB,EAAE,CADI;AAExBC,EAAAA,qBAAqB,EAAE,CAFC;AAGxBC,EAAAA,mBAAmB,EAAE,CAHG;AAIxBC,EAAAA,mBAAmB,EAAE;AAJG,CAAnB,C,CAOP","sourcesContent":["export const ActionType = {\n REANIMATED_WORKLET: 1,\n NATIVE_ANIMATED_EVENT: 2,\n JS_FUNCTION_OLD_API: 3,\n JS_FUNCTION_NEW_API: 4,\n} as const;\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; it can be used as a type and as a value\nexport type ActionType = typeof ActionType[keyof typeof ActionType];\n"]}
|
1
|
+
{"version":3,"sources":["ActionType.ts"],"names":["ActionType","REANIMATED_WORKLET","NATIVE_ANIMATED_EVENT","JS_FUNCTION_OLD_API","JS_FUNCTION_NEW_API"],"mappings":";;;;;;AAAO,MAAMA,UAAU,GAAG;AACxBC,EAAAA,kBAAkB,EAAE,CADI;AAExBC,EAAAA,qBAAqB,EAAE,CAFC;AAGxBC,EAAAA,mBAAmB,EAAE,CAHG;AAIxBC,EAAAA,mBAAmB,EAAE;AAJG,CAAnB,C,CAOP","sourcesContent":["export const ActionType = {\n REANIMATED_WORKLET: 1,\n NATIVE_ANIMATED_EVENT: 2,\n JS_FUNCTION_OLD_API: 3,\n JS_FUNCTION_NEW_API: 4,\n} as const;\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; it can be used as a type and as a value\nexport type ActionType = (typeof ActionType)[keyof typeof ActionType];\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["Directions.ts"],"names":["RIGHT","LEFT","UP","DOWN","Directions","DiagonalDirections","UP_RIGHT","DOWN_RIGHT","UP_LEFT","DOWN_LEFT"],"mappings":";;;;;;AAAA,MAAMA,KAAK,GAAG,CAAd;AACA,MAAMC,IAAI,GAAG,CAAb;AACA,MAAMC,EAAE,GAAG,CAAX;AACA,MAAMC,IAAI,GAAG,CAAb,C,CAEA;;AACO,MAAMC,UAAU,GAAG;AACxBJ,EAAAA,KAAK,EAAEA,KADiB;AAExBC,EAAAA,IAAI,EAAEA,IAFkB;AAGxBC,EAAAA,EAAE,EAAEA,EAHoB;AAIxBC,EAAAA,IAAI,EAAEA;AAJkB,CAAnB,C,CAOP;;;AACO,MAAME,kBAAkB,GAAG;AAChCC,EAAAA,QAAQ,EAAEJ,EAAE,GAAGF,KADiB;AAEhCO,EAAAA,UAAU,EAAEJ,IAAI,GAAGH,KAFa;AAGhCQ,EAAAA,OAAO,EAAEN,EAAE,GAAGD,IAHkB;AAIhCQ,EAAAA,SAAS,EAAEN,IAAI,GAAGF;AAJc,CAA3B,C,CAOP","sourcesContent":["const RIGHT = 1;\nconst LEFT = 2;\nconst UP = 4;\nconst DOWN = 8;\n\n// Public interface\nexport const Directions = {\n RIGHT: RIGHT,\n LEFT: LEFT,\n UP: UP,\n DOWN: DOWN,\n} as const;\n\n// Internal interface\nexport const DiagonalDirections = {\n UP_RIGHT: UP | RIGHT,\n DOWN_RIGHT: DOWN | RIGHT,\n UP_LEFT: UP | LEFT,\n DOWN_LEFT: DOWN | LEFT,\n} as const;\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; it can be used as a type and as a value\nexport type Directions = typeof Directions[keyof typeof Directions];\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport type DiagonalDirections =\n typeof DiagonalDirections[keyof typeof DiagonalDirections];\n"]}
|
1
|
+
{"version":3,"sources":["Directions.ts"],"names":["RIGHT","LEFT","UP","DOWN","Directions","DiagonalDirections","UP_RIGHT","DOWN_RIGHT","UP_LEFT","DOWN_LEFT"],"mappings":";;;;;;AAAA,MAAMA,KAAK,GAAG,CAAd;AACA,MAAMC,IAAI,GAAG,CAAb;AACA,MAAMC,EAAE,GAAG,CAAX;AACA,MAAMC,IAAI,GAAG,CAAb,C,CAEA;;AACO,MAAMC,UAAU,GAAG;AACxBJ,EAAAA,KAAK,EAAEA,KADiB;AAExBC,EAAAA,IAAI,EAAEA,IAFkB;AAGxBC,EAAAA,EAAE,EAAEA,EAHoB;AAIxBC,EAAAA,IAAI,EAAEA;AAJkB,CAAnB,C,CAOP;;;AACO,MAAME,kBAAkB,GAAG;AAChCC,EAAAA,QAAQ,EAAEJ,EAAE,GAAGF,KADiB;AAEhCO,EAAAA,UAAU,EAAEJ,IAAI,GAAGH,KAFa;AAGhCQ,EAAAA,OAAO,EAAEN,EAAE,GAAGD,IAHkB;AAIhCQ,EAAAA,SAAS,EAAEN,IAAI,GAAGF;AAJc,CAA3B,C,CAOP","sourcesContent":["const RIGHT = 1;\nconst LEFT = 2;\nconst UP = 4;\nconst DOWN = 8;\n\n// Public interface\nexport const Directions = {\n RIGHT: RIGHT,\n LEFT: LEFT,\n UP: UP,\n DOWN: DOWN,\n} as const;\n\n// Internal interface\nexport const DiagonalDirections = {\n UP_RIGHT: UP | RIGHT,\n DOWN_RIGHT: DOWN | RIGHT,\n UP_LEFT: UP | LEFT,\n DOWN_LEFT: DOWN | LEFT,\n} as const;\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; it can be used as a type and as a value\nexport type Directions = (typeof Directions)[keyof typeof Directions];\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport type DiagonalDirections =\n (typeof DiagonalDirections)[keyof typeof DiagonalDirections];\n"]}
|
@@ -9,13 +9,26 @@ exports.isNewWebImplementationEnabled = isNewWebImplementationEnabled;
|
|
9
9
|
|
10
10
|
var _reactNative = require("react-native");
|
11
11
|
|
12
|
+
var _utils = require("./utils");
|
13
|
+
|
12
14
|
let useNewWebImplementation = true;
|
13
15
|
let getWasCalled = false;
|
16
|
+
/**
|
17
|
+
* @deprecated new web implementation is enabled by default. This function will be removed in Gesture Handler 3
|
18
|
+
*/
|
14
19
|
|
15
|
-
function enableExperimentalWebImplementation(_shouldEnable = true) {
|
20
|
+
function enableExperimentalWebImplementation(_shouldEnable = true) {
|
21
|
+
// NO-OP since the new implementation is now the default
|
22
|
+
console.warn((0, _utils.tagMessage)('New web implementation is enabled by default. This function will be removed in Gesture Handler 3.'));
|
16
23
|
}
|
24
|
+
/**
|
25
|
+
* @deprecated legacy implementation is no longer supported. This function will be removed in Gesture Handler 3
|
26
|
+
*/
|
27
|
+
|
17
28
|
|
18
29
|
function enableLegacyWebImplementation(shouldUseLegacyImplementation = true) {
|
30
|
+
console.warn((0, _utils.tagMessage)('Legacy web implementation is deprecated. This function will be removed in Gesture Handler 3.'));
|
31
|
+
|
19
32
|
if (_reactNative.Platform.OS !== 'web' || useNewWebImplementation === !shouldUseLegacyImplementation) {
|
20
33
|
return;
|
21
34
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["EnableNewWebImplementation.ts"],"names":["useNewWebImplementation","getWasCalled","enableExperimentalWebImplementation","_shouldEnable","enableLegacyWebImplementation","shouldUseLegacyImplementation","Platform","OS","
|
1
|
+
{"version":3,"sources":["EnableNewWebImplementation.ts"],"names":["useNewWebImplementation","getWasCalled","enableExperimentalWebImplementation","_shouldEnable","console","warn","enableLegacyWebImplementation","shouldUseLegacyImplementation","Platform","OS","error","isNewWebImplementationEnabled"],"mappings":";;;;;;;;;AAAA;;AACA;;AAEA,IAAIA,uBAAuB,GAAG,IAA9B;AACA,IAAIC,YAAY,GAAG,KAAnB;AAEA;AACA;AACA;;AACO,SAASC,mCAAT,CACLC,aAAa,GAAG,IADX,EAEC;AACN;AACAC,EAAAA,OAAO,CAACC,IAAR,CACE,uBACE,mGADF,CADF;AAKD;AAED;AACA;AACA;;;AACO,SAASC,6BAAT,CACLC,6BAA6B,GAAG,IAD3B,EAEC;AACNH,EAAAA,OAAO,CAACC,IAAR,CACE,uBACE,8FADF,CADF;;AAMA,MACEG,sBAASC,EAAT,KAAgB,KAAhB,IACAT,uBAAuB,KAAK,CAACO,6BAF/B,EAGE;AACA;AACD;;AAED,MAAIN,YAAJ,EAAkB;AAChBG,IAAAA,OAAO,CAACM,KAAR,CACE,mLADF;AAGA;AACD;;AAEDV,EAAAA,uBAAuB,GAAG,CAACO,6BAA3B;AACD;;AAEM,SAASI,6BAAT,GAAkD;AACvDV,EAAAA,YAAY,GAAG,IAAf;AACA,SAAOD,uBAAP;AACD","sourcesContent":["import { Platform } from 'react-native';\nimport { tagMessage } from './utils';\n\nlet useNewWebImplementation = true;\nlet getWasCalled = false;\n\n/**\n * @deprecated new web implementation is enabled by default. This function will be removed in Gesture Handler 3\n */\nexport function enableExperimentalWebImplementation(\n _shouldEnable = true\n): void {\n // NO-OP since the new implementation is now the default\n console.warn(\n tagMessage(\n 'New web implementation is enabled by default. This function will be removed in Gesture Handler 3.'\n )\n );\n}\n\n/**\n * @deprecated legacy implementation is no longer supported. This function will be removed in Gesture Handler 3\n */\nexport function enableLegacyWebImplementation(\n shouldUseLegacyImplementation = true\n): void {\n console.warn(\n tagMessage(\n 'Legacy web implementation is deprecated. This function will be removed in Gesture Handler 3.'\n )\n );\n\n if (\n Platform.OS !== 'web' ||\n useNewWebImplementation === !shouldUseLegacyImplementation\n ) {\n return;\n }\n\n if (getWasCalled) {\n console.error(\n 'Some parts of this application have already started using the new gesture handler implementation. No changes will be applied. You can try enabling legacy implementation earlier.'\n );\n return;\n }\n\n useNewWebImplementation = !shouldUseLegacyImplementation;\n}\n\nexport function isNewWebImplementationEnabled(): boolean {\n getWasCalled = true;\n return useNewWebImplementation;\n}\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["State.ts"],"names":["State","UNDETERMINED","FAILED","BEGAN","CANCELLED","ACTIVE","END"],"mappings":";;;;;;AAAA;AAEO,MAAMA,KAAK,GAAG;AACnBC,EAAAA,YAAY,EAAE,CADK;AAEnBC,EAAAA,MAAM,EAAE,CAFW;AAGnBC,EAAAA,KAAK,EAAE,CAHY;AAInBC,EAAAA,SAAS,EAAE,CAJQ;AAKnBC,EAAAA,MAAM,EAAE,CALW;AAMnBC,EAAAA,GAAG,EAAE;AANc,CAAd,C,CASP","sourcesContent":["// TODO use State from RNModule\n\nexport const State = {\n UNDETERMINED: 0,\n FAILED: 1,\n BEGAN: 2,\n CANCELLED: 3,\n ACTIVE: 4,\n END: 5,\n} as const;\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; it can be used as a type and as a value\nexport type State = typeof State[keyof typeof State];\n"]}
|
1
|
+
{"version":3,"sources":["State.ts"],"names":["State","UNDETERMINED","FAILED","BEGAN","CANCELLED","ACTIVE","END"],"mappings":";;;;;;AAAA;AAEO,MAAMA,KAAK,GAAG;AACnBC,EAAAA,YAAY,EAAE,CADK;AAEnBC,EAAAA,MAAM,EAAE,CAFW;AAGnBC,EAAAA,KAAK,EAAE,CAHY;AAInBC,EAAAA,SAAS,EAAE,CAJQ;AAKnBC,EAAAA,MAAM,EAAE,CALW;AAMnBC,EAAAA,GAAG,EAAE;AANc,CAAd,C,CASP","sourcesContent":["// TODO use State from RNModule\n\nexport const State = {\n UNDETERMINED: 0,\n FAILED: 1,\n BEGAN: 2,\n CANCELLED: 3,\n ACTIVE: 4,\n END: 5,\n} as const;\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; it can be used as a type and as a value\nexport type State = (typeof State)[keyof typeof State];\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["TouchEventType.ts"],"names":["TouchEventType","UNDETERMINED","TOUCHES_DOWN","TOUCHES_MOVE","TOUCHES_UP","TOUCHES_CANCELLED"],"mappings":";;;;;;AAAO,MAAMA,cAAc,GAAG;AAC5BC,EAAAA,YAAY,EAAE,CADc;AAE5BC,EAAAA,YAAY,EAAE,CAFc;AAG5BC,EAAAA,YAAY,EAAE,CAHc;AAI5BC,EAAAA,UAAU,EAAE,CAJgB;AAK5BC,EAAAA,iBAAiB,EAAE;AALS,CAAvB,C,CAQP","sourcesContent":["export const TouchEventType = {\n UNDETERMINED: 0,\n TOUCHES_DOWN: 1,\n TOUCHES_MOVE: 2,\n TOUCHES_UP: 3,\n TOUCHES_CANCELLED: 4,\n} as const;\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; it can be used as a type and as a value\nexport type TouchEventType
|
1
|
+
{"version":3,"sources":["TouchEventType.ts"],"names":["TouchEventType","UNDETERMINED","TOUCHES_DOWN","TOUCHES_MOVE","TOUCHES_UP","TOUCHES_CANCELLED"],"mappings":";;;;;;AAAO,MAAMA,cAAc,GAAG;AAC5BC,EAAAA,YAAY,EAAE,CADc;AAE5BC,EAAAA,YAAY,EAAE,CAFc;AAG5BC,EAAAA,YAAY,EAAE,CAHc;AAI5BC,EAAAA,UAAU,EAAE,CAJgB;AAK5BC,EAAAA,iBAAiB,EAAE;AALS,CAAvB,C,CAQP","sourcesContent":["export const TouchEventType = {\n UNDETERMINED: 0,\n TOUCHES_DOWN: 1,\n TOUCHES_MOVE: 2,\n TOUCHES_UP: 3,\n TOUCHES_CANCELLED: 4,\n} as const;\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; it can be used as a type and as a value\nexport type TouchEventType =\n (typeof TouchEventType)[keyof typeof TouchEventType];\n"]}
|
@@ -275,7 +275,7 @@ function Pressable(props) {
|
|
275
275
|
}), [pressInHandler, pressOutHandler]);
|
276
276
|
const appliedHitSlop = (0, _utils.addInsets)(normalizedHitSlop, normalizedPressRetentionOffset);
|
277
277
|
const isPressableEnabled = disabled !== true;
|
278
|
-
const gestures = [pressAndTouchGesture, hoverGesture
|
278
|
+
const gestures = [buttonGesture, pressAndTouchGesture, hoverGesture];
|
279
279
|
|
280
280
|
for (const gesture of gestures) {
|
281
281
|
gesture.enabled(isPressableEnabled);
|