react-native-gesture-handler 2.31.2 → 2.32.0
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/RNGestureHandler.podspec +1 -1
- package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandler.kt +6 -1
- package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerOrchestrator.kt +5 -3
- package/android/src/main/java/com/swmansion/gesturehandler/core/HoverGestureHandler.kt +1 -6
- package/android/src/main/java/com/swmansion/gesturehandler/core/LongPressGestureHandler.kt +1 -1
- package/android/src/main/java/com/swmansion/gesturehandler/core/ViewConfigurationHelper.kt +0 -1
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNViewConfigurationHelper.kt +0 -6
- package/apple/RNGestureHandler.mm +11 -7
- package/apple/RNGestureHandlerButton.mm +4 -4
- package/apple/RNGestureHandlerButtonComponentView.mm +12 -0
- package/apple/RNGestureHandlerManager.mm +5 -11
- package/jestSetup.js +6 -5
- package/lib/commonjs/handlers/gestures/GestureDetector/useDetectorUpdater.js +1 -2
- package/lib/commonjs/handlers/gestures/GestureDetector/useDetectorUpdater.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/utils.js +1 -49
- package/lib/commonjs/handlers/gestures/GestureDetector/utils.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector/useDetectorUpdater.js +1 -2
- package/lib/module/handlers/gestures/GestureDetector/useDetectorUpdater.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector/utils.js +1 -48
- package/lib/module/handlers/gestures/GestureDetector/utils.js.map +1 -1
- package/lib/typescript/handlers/gestures/GestureDetector/useDetectorUpdater.d.ts.map +1 -1
- package/lib/typescript/handlers/gestures/GestureDetector/utils.d.ts +0 -1
- package/lib/typescript/handlers/gestures/GestureDetector/utils.d.ts.map +1 -1
- package/package.json +7 -6
- package/scripts/gesture_handler_utils.rb +23 -17
- package/src/handlers/gestures/GestureDetector/useDetectorUpdater.ts +1 -2
- package/src/handlers/gestures/GestureDetector/utils.ts +1 -53
- package/lib/commonjs/RNRenderer.js +0 -14
- package/lib/commonjs/RNRenderer.js.map +0 -1
- package/lib/commonjs/RNRenderer.web.js +0 -10
- package/lib/commonjs/RNRenderer.web.js.map +0 -1
- package/lib/module/RNRenderer.js +0 -6
- package/lib/module/RNRenderer.js.map +0 -1
- package/lib/module/RNRenderer.web.js +0 -6
- package/lib/module/RNRenderer.web.js.map +0 -1
- package/lib/typescript/RNRenderer.d.ts +0 -2
- package/lib/typescript/RNRenderer.d.ts.map +0 -1
- package/lib/typescript/RNRenderer.web.d.ts +0 -4
- package/lib/typescript/RNRenderer.web.d.ts.map +0 -1
- package/src/RNRenderer.ts +0 -3
- package/src/RNRenderer.web.ts +0 -3
package/RNGestureHandler.podspec
CHANGED
|
@@ -5,7 +5,7 @@ is_gh_example_app = ENV["GH_EXAMPLE_APP_NAME"] != nil
|
|
|
5
5
|
|
|
6
6
|
compilation_metadata_dir = "CompilationDatabase"
|
|
7
7
|
compilation_metadata_generation_flag = is_gh_example_app ? '-gen-cdb-fragment-path ' + compilation_metadata_dir : ''
|
|
8
|
-
version_flag = "-DREACT_NATIVE_MINOR_VERSION=#{get_react_native_minor_version()}"
|
|
8
|
+
version_flag = "-DREACT_NATIVE_MINOR_VERSION=#{GestureHandlerUtils.get_react_native_minor_version()}"
|
|
9
9
|
|
|
10
10
|
Pod::Spec.new do |s|
|
|
11
11
|
# NPM package specification
|
|
@@ -362,9 +362,14 @@ open class GestureHandler {
|
|
|
362
362
|
}
|
|
363
363
|
}
|
|
364
364
|
|
|
365
|
+
numberOfPointers = when (adaptedTransformedEvent.actionMasked) {
|
|
366
|
+
MotionEvent.ACTION_POINTER_UP -> adaptedTransformedEvent.pointerCount - 1
|
|
367
|
+
else -> adaptedTransformedEvent.pointerCount
|
|
368
|
+
}
|
|
369
|
+
|
|
365
370
|
x = adaptedTransformedEvent.x
|
|
366
371
|
y = adaptedTransformedEvent.y
|
|
367
|
-
|
|
372
|
+
|
|
368
373
|
isWithinBounds = isWithinBounds(view, x, y)
|
|
369
374
|
if (shouldCancelWhenOutside && !isWithinBounds) {
|
|
370
375
|
if (state == STATE_ACTIVE) {
|
package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerOrchestrator.kt
CHANGED
|
@@ -180,14 +180,16 @@ class GestureHandlerOrchestrator(
|
|
|
180
180
|
} else if (prevState == GestureHandler.STATE_ACTIVE || prevState == GestureHandler.STATE_END) {
|
|
181
181
|
if (handler.isActive) {
|
|
182
182
|
handler.dispatchStateChange(newState, prevState)
|
|
183
|
-
} else if (
|
|
184
|
-
(newState == GestureHandler.STATE_CANCELLED || newState == GestureHandler.STATE_FAILED)
|
|
183
|
+
} else if (newState == GestureHandler.STATE_CANCELLED || newState == GestureHandler.STATE_FAILED
|
|
185
184
|
) {
|
|
186
185
|
// Handle edge case where handler awaiting for another one tries to activate but finishes
|
|
187
186
|
// before the other would not send state change event upon ending. Note that we only want
|
|
188
187
|
// to do this if the newState is either CANCELLED or FAILED, if it is END we still want to
|
|
189
188
|
// wait for the other handler to finish as in that case synthetic events will be sent by the
|
|
190
189
|
// makeActive method.
|
|
190
|
+
// This also covers the case where a discrete gesture (e.g. Tap) ends immediately after
|
|
191
|
+
// activation (STATE_ACTIVE -> STATE_END) while still awaiting another handler, and is later
|
|
192
|
+
// cancelled when that handler activates.
|
|
191
193
|
handler.dispatchStateChange(newState, GestureHandler.STATE_BEGAN)
|
|
192
194
|
}
|
|
193
195
|
} else if (prevState != GestureHandler.STATE_UNDETERMINED ||
|
|
@@ -596,7 +598,7 @@ class GestureHandlerOrchestrator(
|
|
|
596
598
|
|
|
597
599
|
val childrenCount = viewGroup.childCount
|
|
598
600
|
for (i in childrenCount - 1 downTo 0) {
|
|
599
|
-
val child =
|
|
601
|
+
val child = viewGroup.getChildAt(i)
|
|
600
602
|
if (canReceiveEvents(child)) {
|
|
601
603
|
val childPoint = tempPoint
|
|
602
604
|
transformPointToChildViewCoords(coords[0], coords[1], viewGroup, child, childPoint)
|
|
@@ -7,7 +7,6 @@ import android.view.MotionEvent
|
|
|
7
7
|
import android.view.View
|
|
8
8
|
import android.view.ViewGroup
|
|
9
9
|
import com.swmansion.gesturehandler.react.RNGestureHandlerRootHelper
|
|
10
|
-
import com.swmansion.gesturehandler.react.RNViewConfigurationHelper
|
|
11
10
|
import com.swmansion.gesturehandler.react.eventbuilders.HoverGestureHandlerEventDataBuilder
|
|
12
11
|
|
|
13
12
|
class HoverGestureHandler : GestureHandler() {
|
|
@@ -42,7 +41,7 @@ class HoverGestureHandler : GestureHandler() {
|
|
|
42
41
|
|
|
43
42
|
if (rootView is ViewGroup) {
|
|
44
43
|
for (i in 0 until rootView.childCount) {
|
|
45
|
-
val child =
|
|
44
|
+
val child = rootView.getChildAt(i)
|
|
46
45
|
return isViewDisplayedOverAnother(view, other, child) ?: continue
|
|
47
46
|
}
|
|
48
47
|
}
|
|
@@ -143,8 +142,4 @@ class HoverGestureHandler : GestureHandler() {
|
|
|
143
142
|
|
|
144
143
|
override fun createEventBuilder(handler: HoverGestureHandler) = HoverGestureHandlerEventDataBuilder(handler)
|
|
145
144
|
}
|
|
146
|
-
|
|
147
|
-
companion object {
|
|
148
|
-
private val viewConfigHelper = RNViewConfigurationHelper()
|
|
149
|
-
}
|
|
150
145
|
}
|
|
@@ -190,7 +190,7 @@ class LongPressGestureHandler(context: Context) : GestureHandler() {
|
|
|
190
190
|
handler.maxDist = PixelUtil.toPixelFromDIP(config.getDouble(KEY_MAX_DIST))
|
|
191
191
|
}
|
|
192
192
|
if (config.hasKey(KEY_NUMBER_OF_POINTERS)) {
|
|
193
|
-
handler.
|
|
193
|
+
handler.numberOfPointersRequired = config.getInt(KEY_NUMBER_OF_POINTERS)
|
|
194
194
|
}
|
|
195
195
|
}
|
|
196
196
|
|
package/android/src/main/java/com/swmansion/gesturehandler/react/RNViewConfigurationHelper.kt
CHANGED
|
@@ -38,12 +38,6 @@ class RNViewConfigurationHelper : ViewConfigurationHelper {
|
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
override fun getChildInDrawingOrderAtIndex(parent: ViewGroup, index: Int): View = if (parent is ReactViewGroup) {
|
|
42
|
-
parent.getChildAt(parent.getZIndexMappedChildIndex(index))
|
|
43
|
-
} else {
|
|
44
|
-
parent.getChildAt(index)
|
|
45
|
-
}
|
|
46
|
-
|
|
47
41
|
override fun isViewClippingChildren(view: ViewGroup) = when {
|
|
48
42
|
view.clipChildren -> true
|
|
49
43
|
view is ReactScrollView -> view.overflow != "visible"
|
|
@@ -483,15 +483,19 @@ static NSHashTable<RNGestureHandler *> *allGestureHandlers;
|
|
|
483
483
|
|
|
484
484
|
// We may try to extract "DummyGestureHandler" in case when "otherGestureRecognizer" belongs to
|
|
485
485
|
// a native view being wrapped with "NativeViewGestureHandler"
|
|
486
|
-
RNGHUIView *
|
|
487
|
-
while (
|
|
488
|
-
|
|
489
|
-
|
|
486
|
+
RNGHUIView *view = recognizer.view;
|
|
487
|
+
while (view != nil) {
|
|
488
|
+
for (UIGestureRecognizer *candidateRecognizer in view.gestureRecognizers) {
|
|
489
|
+
if ([candidateRecognizer isKindOfClass:[RNDummyGestureRecognizer class]]) {
|
|
490
|
+
return candidateRecognizer.gestureHandler;
|
|
491
|
+
}
|
|
492
|
+
}
|
|
490
493
|
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
return recognizer.gestureHandler;
|
|
494
|
+
if ([view isKindOfClass:[RCTViewComponentView class]]) {
|
|
495
|
+
return nil;
|
|
494
496
|
}
|
|
497
|
+
|
|
498
|
+
view = view.superview;
|
|
495
499
|
}
|
|
496
500
|
|
|
497
501
|
return nil;
|
|
@@ -95,11 +95,11 @@
|
|
|
95
95
|
- (RNGHUIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
|
|
96
96
|
{
|
|
97
97
|
RNGestureHandlerPointerEvents pointerEvents = _pointerEvents;
|
|
98
|
-
|
|
98
|
+
|
|
99
99
|
if (pointerEvents == RNGestureHandlerPointerEventsNone) {
|
|
100
100
|
return nil;
|
|
101
101
|
}
|
|
102
|
-
|
|
102
|
+
|
|
103
103
|
if (pointerEvents == RNGestureHandlerPointerEventsBoxNone) {
|
|
104
104
|
for (UIView *subview in [self.subviews reverseObjectEnumerator]) {
|
|
105
105
|
if (!subview.isHidden && subview.alpha > 0) {
|
|
@@ -112,11 +112,11 @@
|
|
|
112
112
|
}
|
|
113
113
|
return nil;
|
|
114
114
|
}
|
|
115
|
-
|
|
115
|
+
|
|
116
116
|
if (pointerEvents == RNGestureHandlerPointerEventsBoxOnly) {
|
|
117
117
|
return [self pointInside:point withEvent:event] ? self : nil;
|
|
118
118
|
}
|
|
119
|
-
|
|
119
|
+
|
|
120
120
|
RNGHUIView *inner = [super hitTest:point withEvent:event];
|
|
121
121
|
while (inner && ![self shouldHandleTouch:inner]) {
|
|
122
122
|
inner = inner.superview;
|
|
@@ -240,6 +240,18 @@ static RNGestureHandlerPointerEvents RCTPointerEventsToEnum(facebook::react::Poi
|
|
|
240
240
|
}
|
|
241
241
|
|
|
242
242
|
[super updateProps:props oldProps:oldProps];
|
|
243
|
+
|
|
244
|
+
#if !TARGET_OS_TV && !TARGET_OS_OSX
|
|
245
|
+
// super's updateProps sets self.accessibilityIdentifier from testID via the
|
|
246
|
+
// standard Fabric mechanism. However, setAccessibilityProps already forwards
|
|
247
|
+
// testID to _buttonView.accessibilityIdentifier (the actual button element).
|
|
248
|
+
// Having the identifier on both views causes testing frameworks (e.g. Detox)
|
|
249
|
+
// to report multiple matches for the same testID. Clear it from the wrapper so
|
|
250
|
+
// only _buttonView carries the identifier.
|
|
251
|
+
if (!newProps.testId.empty()) {
|
|
252
|
+
self.accessibilityIdentifier = nil;
|
|
253
|
+
}
|
|
254
|
+
#endif
|
|
243
255
|
}
|
|
244
256
|
|
|
245
257
|
#if !TARGET_OS_OSX
|
|
@@ -435,11 +435,11 @@ constexpr int NEW_ARCH_NUMBER_OF_ATTACH_RETRIES = 25;
|
|
|
435
435
|
|
|
436
436
|
- (void)sendEventForNativeAnimatedEvent:(RNGestureHandlerStateChange *)event
|
|
437
437
|
{
|
|
438
|
-
// Delivers the event to
|
|
439
|
-
//
|
|
440
|
-
//
|
|
441
|
-
//
|
|
442
|
-
[
|
|
438
|
+
// Delivers the event to NativeAnimated[Turbo]Module via the dispatcher's
|
|
439
|
+
// observer mechanism. We don't go through sendEvent: because that also
|
|
440
|
+
// dispatches the event to JS via RCTEventEmitter.receiveEvent, which is no
|
|
441
|
+
// longer a registered callable module in RN 0.86+ (Fabric-only).
|
|
442
|
+
[_eventDispatcher notifyObserversOfEvent:event];
|
|
443
443
|
}
|
|
444
444
|
|
|
445
445
|
- (void)sendEventForJSFunctionOldAPI:(RNGestureHandlerStateChange *)event
|
|
@@ -458,12 +458,6 @@ constexpr int NEW_ARCH_NUMBER_OF_ATTACH_RETRIES = 25;
|
|
|
458
458
|
[self sendEventForDeviceEvent:event];
|
|
459
459
|
}
|
|
460
460
|
|
|
461
|
-
- (void)sendEventForDirectEvent:(RNGestureHandlerStateChange *)event
|
|
462
|
-
{
|
|
463
|
-
// Delivers the event to JS as a direct event.
|
|
464
|
-
[_eventDispatcher sendEvent:event];
|
|
465
|
-
}
|
|
466
|
-
|
|
467
461
|
- (void)sendEventForDeviceEvent:(RNGestureHandlerStateChange *)event
|
|
468
462
|
{
|
|
469
463
|
// Delivers the event to JS as a device event.
|
package/jestSetup.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
jest.mock('./src/RNGestureHandlerModule', () => require('./src/mocks/mocks'));
|
|
2
|
-
jest.mock('./src/components/GestureButtons', () =>
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
jest.mock('./src/components/GestureButtons', () =>
|
|
3
|
+
require('./src/mocks/mocks')
|
|
4
|
+
);
|
|
5
|
+
jest.mock('./src/components/Pressable/Pressable', () =>
|
|
6
|
+
require('./src/mocks/Pressable')
|
|
7
|
+
);
|
|
5
8
|
|
|
6
9
|
jest.mock('./lib/commonjs/RNGestureHandlerModule', () =>
|
|
7
10
|
require('./lib/commonjs/mocks/mocks')
|
|
@@ -13,7 +16,6 @@ jest.mock('./lib/commonjs/components/Pressable', () =>
|
|
|
13
16
|
require('./lib/commonjs/mocks/Pressable')
|
|
14
17
|
);
|
|
15
18
|
|
|
16
|
-
|
|
17
19
|
jest.mock('./lib/module/RNGestureHandlerModule', () =>
|
|
18
20
|
require('./lib/module/mocks/mocks')
|
|
19
21
|
);
|
|
@@ -23,4 +25,3 @@ jest.mock('./lib/module/components/GestureButtons', () =>
|
|
|
23
25
|
jest.mock('./lib/module/components/Pressable', () =>
|
|
24
26
|
require('./lib/module/mocks/Pressable')
|
|
25
27
|
);
|
|
26
|
-
|
|
@@ -9,8 +9,8 @@ var _attachHandlers = require("./attachHandlers");
|
|
|
9
9
|
var _updateHandlers = require("./updateHandlers");
|
|
10
10
|
var _needsToReattach = require("./needsToReattach");
|
|
11
11
|
var _dropHandlers = require("./dropHandlers");
|
|
12
|
-
var _utils = require("./utils");
|
|
13
12
|
var _findNodeHandle = _interopRequireDefault(require("../../../findNodeHandle"));
|
|
13
|
+
var _utils = require("./utils");
|
|
14
14
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
15
|
// Returns a function that's responsible for updating the attached gestures
|
|
16
16
|
// If the view has changed, it will reattach the handlers to the new view
|
|
@@ -24,7 +24,6 @@ function useDetectorUpdater(state, preparedGesture, gesturesToAttach, gestureCon
|
|
|
24
24
|
const viewTag = (0, _findNodeHandle.default)(state.viewRef);
|
|
25
25
|
const didUnderlyingViewChange = viewTag !== state.previousViewTag;
|
|
26
26
|
if (didUnderlyingViewChange || (0, _needsToReattach.needsToReattach)(preparedGesture, gesturesToAttach)) {
|
|
27
|
-
(0, _utils.validateDetectorChildren)(state.viewRef);
|
|
28
27
|
(0, _dropHandlers.dropHandlers)(preparedGesture);
|
|
29
28
|
(0, _attachHandlers.attachHandlers)({
|
|
30
29
|
preparedGesture,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_attachHandlers","_updateHandlers","_needsToReattach","_dropHandlers","
|
|
1
|
+
{"version":3,"names":["_react","require","_attachHandlers","_updateHandlers","_needsToReattach","_dropHandlers","_findNodeHandle","_interopRequireDefault","_utils","e","__esModule","default","useDetectorUpdater","state","preparedGesture","gesturesToAttach","gestureConfig","webEventHandlersRef","forceRender","useForceRender","updateAttachedGestures","useCallback","skipConfigUpdate","viewTag","findNodeHandle","viewRef","didUnderlyingViewChange","previousViewTag","needsToReattach","dropHandlers","attachHandlers","forceRebuildReanimatedEvent","updateHandlers"],"sourceRoot":"../../../../../src","sources":["handlers/gestures/GestureDetector/useDetectorUpdater.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AASA,IAAAC,eAAA,GAAAD,OAAA;AACA,IAAAE,eAAA,GAAAF,OAAA;AACA,IAAAG,gBAAA,GAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AACA,IAAAK,eAAA,GAAAC,sBAAA,CAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AAAyC,SAAAM,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEzC;AACA;AACA;AACO,SAASG,kBAAkBA,CAChCC,KAA2B,EAC3BC,eAAqC,EACrCC,gBAA+B,EAC/BC,aAA4C,EAC5CC,mBAAqD,EACrD;EACA,MAAMC,WAAW,GAAG,IAAAC,qBAAc,EAAC,CAAC;EACpC,MAAMC,sBAAsB,GAAG,IAAAC,kBAAW;EACxC;EACCC,gBAA0B,IAAK;IAC9B;IACA,MAAMC,OAAO,GAAG,IAAAC,uBAAc,EAACX,KAAK,CAACY,OAAO,CAAW;IACvD,MAAMC,uBAAuB,GAAGH,OAAO,KAAKV,KAAK,CAACc,eAAe;IAEjE,IACED,uBAAuB,IACvB,IAAAE,gCAAe,EAACd,eAAe,EAAEC,gBAAgB,CAAC,EAClD;MACA,IAAAc,0BAAY,EAACf,eAAe,CAAC;MAC7B,IAAAgB,8BAAc,EAAC;QACbhB,eAAe;QACfE,aAAa;QACbD,gBAAgB;QAChBE,mBAAmB;QACnBM;MACF,CAAC,CAAC;MAEF,IAAIG,uBAAuB,EAAE;QAC3Bb,KAAK,CAACc,eAAe,GAAGJ,OAAO;QAC/BV,KAAK,CAACkB,2BAA2B,GAAG,IAAI;QACxCb,WAAW,CAAC,CAAC;MACf;IACF,CAAC,MAAM,IAAI,CAACI,gBAAgB,EAAE;MAC5B,IAAAU,8BAAc,EAAClB,eAAe,EAAEE,aAAa,EAAED,gBAAgB,CAAC;IAClE;EACF,CAAC,EACD,CACEG,WAAW,EACXF,aAAa,EACbD,gBAAgB,EAChBD,eAAe,EACfD,KAAK,EACLI,mBAAmB,CAEvB,CAAC;EAED,OAAOG,sBAAsB;AAC/B","ignoreList":[]}
|
|
@@ -8,8 +8,7 @@ exports.checkGestureCallbacksForWorklets = checkGestureCallbacksForWorklets;
|
|
|
8
8
|
exports.extractGestureRelations = extractGestureRelations;
|
|
9
9
|
exports.useForceRender = useForceRender;
|
|
10
10
|
exports.useWebEventHandlers = useWebEventHandlers;
|
|
11
|
-
|
|
12
|
-
var _reactNative = require("react-native");
|
|
11
|
+
var _react = require("react");
|
|
13
12
|
var _utils = require("../../../utils");
|
|
14
13
|
var _gesture = require("../gesture");
|
|
15
14
|
var _FlingGestureHandler = require("../../FlingGestureHandler");
|
|
@@ -21,8 +20,6 @@ var _hoverGesture = require("../hoverGesture");
|
|
|
21
20
|
var _NativeViewGestureHandler = require("../../NativeViewGestureHandler");
|
|
22
21
|
var _gestureHandlerCommon = require("../../gestureHandlerCommon");
|
|
23
22
|
var _EnableNewWebImplementation = require("../../../EnableNewWebImplementation");
|
|
24
|
-
var _RNRenderer = require("../../../RNRenderer");
|
|
25
|
-
var _react = require("react");
|
|
26
23
|
var _reanimatedWrapper = require("../reanimatedWrapper");
|
|
27
24
|
var _eventReceiver = require("../eventReceiver");
|
|
28
25
|
const ALLOWED_PROPS = exports.ALLOWED_PROPS = [..._gestureHandlerCommon.baseGestureHandlerWithDetectorProps, ..._TapGestureHandler.tapGestureHandlerProps, ..._PanGestureHandler.panGestureHandlerProps, ..._PanGestureHandler.panGestureHandlerCustomNativeProps, ..._LongPressGestureHandler.longPressGestureHandlerProps, ..._ForceTouchGestureHandler.forceTouchGestureHandlerProps, ..._FlingGestureHandler.flingGestureHandlerProps, ..._hoverGesture.hoverGestureHandlerProps, ..._NativeViewGestureHandler.nativeViewGestureHandlerProps];
|
|
@@ -88,51 +85,6 @@ function checkGestureCallbacksForWorklets(gesture) {
|
|
|
88
85
|
console.warn((0, _utils.tagMessage)(`None of the callbacks in the gesture are worklets. If you wish to run them on the JS thread use '.runOnJS(true)' modifier on the gesture to make this explicit. Otherwise, mark the callbacks as 'worklet' to run them on the UI thread.`));
|
|
89
86
|
}
|
|
90
87
|
}
|
|
91
|
-
|
|
92
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
93
|
-
function validateDetectorChildren(ref) {
|
|
94
|
-
// Finds the first native view under the Wrap component and traverses the fiber tree upwards
|
|
95
|
-
// to check whether there is more than one native view as a pseudo-direct child of GestureDetector
|
|
96
|
-
// i.e. this is not ok:
|
|
97
|
-
// Wrap
|
|
98
|
-
// |
|
|
99
|
-
// / \
|
|
100
|
-
// / \
|
|
101
|
-
// / \
|
|
102
|
-
// / \
|
|
103
|
-
// NativeView NativeView
|
|
104
|
-
//
|
|
105
|
-
// but this is fine:
|
|
106
|
-
// Wrap
|
|
107
|
-
// |
|
|
108
|
-
// NativeView
|
|
109
|
-
// |
|
|
110
|
-
// / \
|
|
111
|
-
// / \
|
|
112
|
-
// / \
|
|
113
|
-
// / \
|
|
114
|
-
// NativeView NativeView
|
|
115
|
-
if (__DEV__ && _reactNative.Platform.OS !== 'web') {
|
|
116
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
117
|
-
const wrapType =
|
|
118
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
119
|
-
ref._reactInternals.elementType;
|
|
120
|
-
|
|
121
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
122
|
-
let instance = _RNRenderer.RNRenderer.findHostInstance_DEPRECATED(ref)._internalFiberInstanceHandleDEV;
|
|
123
|
-
|
|
124
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
125
|
-
while (instance && instance.elementType !== wrapType) {
|
|
126
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
127
|
-
if (instance.sibling) {
|
|
128
|
-
throw new Error('GestureDetector has more than one native view as its children. This can happen if you are using a custom component that renders multiple views, like React.Fragment. You should wrap content of GestureDetector with a <View> or <Animated.View>.');
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
|
|
132
|
-
instance = instance.return;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
88
|
function useForceRender() {
|
|
137
89
|
const [renderState, setRenderState] = (0, _react.useState)(false);
|
|
138
90
|
const forceRender = (0, _react.useCallback)(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["_react","require","_utils","_gesture","_FlingGestureHandler","_ForceTouchGestureHandler","_LongPressGestureHandler","_PanGestureHandler","_TapGestureHandler","_hoverGesture","_NativeViewGestureHandler","_gestureHandlerCommon","_EnableNewWebImplementation","_reanimatedWrapper","_eventReceiver","ALLOWED_PROPS","exports","baseGestureHandlerWithDetectorProps","tapGestureHandlerProps","panGestureHandlerProps","panGestureHandlerCustomNativeProps","longPressGestureHandlerProps","forceTouchGestureHandlerProps","flingGestureHandlerProps","hoverGestureHandlerProps","nativeViewGestureHandlerProps","emptyWorklet","wasBabelPluginEnabled","__workletHash","undefined","convertToHandlerTag","ref","BaseGesture","handlerTag","current","extractValidHandlerTags","interactionGroup","Array","from","Set","map","filter","tag","extractGestureRelations","gesture","config","requireToFail","simultaneousWith","blocksHandlers","waitFor","simultaneousHandlers","checkGestureCallbacksForWorklets","__DEV__","runOnJS","areSomeNotWorklets","handlers","isWorklet","includes","areSomeWorklets","console","error","tagMessage","Reanimated","areAllNotWorklets","isTestEnv","warn","useForceRender","renderState","setRenderState","useState","forceRender","useCallback","useWebEventHandlers","useRef","onGestureHandlerEvent","e","nativeEvent","onGestureHandlerStateChange","isNewWebImplementationEnabled"],"sourceRoot":"../../../../../src","sources":["handlers/gestures/GestureDetector/utils.ts"],"mappings":";;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAEA,IAAAG,oBAAA,GAAAH,OAAA;AACA,IAAAI,yBAAA,GAAAJ,OAAA;AACA,IAAAK,wBAAA,GAAAL,OAAA;AACA,IAAAM,kBAAA,GAAAN,OAAA;AAIA,IAAAO,kBAAA,GAAAP,OAAA;AACA,IAAAQ,aAAA,GAAAR,OAAA;AACA,IAAAS,yBAAA,GAAAT,OAAA;AACA,IAAAU,qBAAA,GAAAV,OAAA;AAIA,IAAAW,2BAAA,GAAAX,OAAA;AACA,IAAAY,kBAAA,GAAAZ,OAAA;AACA,IAAAa,cAAA,GAAAb,OAAA;AAGO,MAAMc,aAAa,GAAAC,OAAA,CAAAD,aAAA,GAAG,CAC3B,GAAGE,yDAAmC,EACtC,GAAGC,yCAAsB,EACzB,GAAGC,yCAAsB,EACzB,GAAGC,qDAAkC,EACrC,GAAGC,qDAA4B,EAC/B,GAAGC,uDAA6B,EAChC,GAAGC,6CAAwB,EAC3B,GAAGC,sCAAwB,EAC3B,GAAGC,uDAA6B,CACjC;;AAED;AACA;AACA;AACA,SAASC,YAAYA,CAAA,EAAG;EACtB,SAAS;AACX;;AAEA;AACA,MAA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 +5,8 @@ import { attachHandlers } from './attachHandlers';
|
|
|
5
5
|
import { updateHandlers } from './updateHandlers';
|
|
6
6
|
import { needsToReattach } from './needsToReattach';
|
|
7
7
|
import { dropHandlers } from './dropHandlers';
|
|
8
|
-
import { useForceRender, validateDetectorChildren } from './utils';
|
|
9
8
|
import findNodeHandle from '../../../findNodeHandle';
|
|
9
|
+
import { useForceRender } from './utils';
|
|
10
10
|
|
|
11
11
|
// Returns a function that's responsible for updating the attached gestures
|
|
12
12
|
// If the view has changed, it will reattach the handlers to the new view
|
|
@@ -20,7 +20,6 @@ export function useDetectorUpdater(state, preparedGesture, gesturesToAttach, ges
|
|
|
20
20
|
const viewTag = findNodeHandle(state.viewRef);
|
|
21
21
|
const didUnderlyingViewChange = viewTag !== state.previousViewTag;
|
|
22
22
|
if (didUnderlyingViewChange || needsToReattach(preparedGesture, gesturesToAttach)) {
|
|
23
|
-
validateDetectorChildren(state.viewRef);
|
|
24
23
|
dropHandlers(preparedGesture);
|
|
25
24
|
attachHandlers({
|
|
26
25
|
preparedGesture,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useCallback","attachHandlers","updateHandlers","needsToReattach","dropHandlers","
|
|
1
|
+
{"version":3,"names":["useCallback","attachHandlers","updateHandlers","needsToReattach","dropHandlers","findNodeHandle","useForceRender","useDetectorUpdater","state","preparedGesture","gesturesToAttach","gestureConfig","webEventHandlersRef","forceRender","updateAttachedGestures","skipConfigUpdate","viewTag","viewRef","didUnderlyingViewChange","previousViewTag","forceRebuildReanimatedEvent"],"sourceRoot":"../../../../../src","sources":["handlers/gestures/GestureDetector/useDetectorUpdater.ts"],"mappings":";;AAAA,SAAgBA,WAAW,QAAQ,OAAO;AAS1C,SAASC,cAAc,QAAQ,kBAAkB;AACjD,SAASC,cAAc,QAAQ,kBAAkB;AACjD,SAASC,eAAe,QAAQ,mBAAmB;AACnD,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,OAAOC,cAAc,MAAM,yBAAyB;AACpD,SAASC,cAAc,QAAQ,SAAS;;AAExC;AACA;AACA;AACA,OAAO,SAASC,kBAAkBA,CAChCC,KAA2B,EAC3BC,eAAqC,EACrCC,gBAA+B,EAC/BC,aAA4C,EAC5CC,mBAAqD,EACrD;EACA,MAAMC,WAAW,GAAGP,cAAc,CAAC,CAAC;EACpC,MAAMQ,sBAAsB,GAAGd,WAAW;EACxC;EACCe,gBAA0B,IAAK;IAC9B;IACA,MAAMC,OAAO,GAAGX,cAAc,CAACG,KAAK,CAACS,OAAO,CAAW;IACvD,MAAMC,uBAAuB,GAAGF,OAAO,KAAKR,KAAK,CAACW,eAAe;IAEjE,IACED,uBAAuB,IACvBf,eAAe,CAACM,eAAe,EAAEC,gBAAgB,CAAC,EAClD;MACAN,YAAY,CAACK,eAAe,CAAC;MAC7BR,cAAc,CAAC;QACbQ,eAAe;QACfE,aAAa;QACbD,gBAAgB;QAChBE,mBAAmB;QACnBI;MACF,CAAC,CAAC;MAEF,IAAIE,uBAAuB,EAAE;QAC3BV,KAAK,CAACW,eAAe,GAAGH,OAAO;QAC/BR,KAAK,CAACY,2BAA2B,GAAG,IAAI;QACxCP,WAAW,CAAC,CAAC;MACf;IACF,CAAC,MAAM,IAAI,CAACE,gBAAgB,EAAE;MAC5Bb,cAAc,CAACO,eAAe,EAAEE,aAAa,EAAED,gBAAgB,CAAC;IAClE;EACF,CAAC,EACD,CACEG,WAAW,EACXF,aAAa,EACbD,gBAAgB,EAChBD,eAAe,EACfD,KAAK,EACLI,mBAAmB,CAEvB,CAAC;EAED,OAAOE,sBAAsB;AAC/B","ignoreList":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { useCallback, useRef, useState } from 'react';
|
|
4
4
|
import { isTestEnv, tagMessage } from '../../../utils';
|
|
5
5
|
import { BaseGesture } from '../gesture';
|
|
6
6
|
import { flingGestureHandlerProps } from '../../FlingGestureHandler';
|
|
@@ -12,8 +12,6 @@ import { hoverGestureHandlerProps } from '../hoverGesture';
|
|
|
12
12
|
import { nativeViewGestureHandlerProps } from '../../NativeViewGestureHandler';
|
|
13
13
|
import { baseGestureHandlerWithDetectorProps } from '../../gestureHandlerCommon';
|
|
14
14
|
import { isNewWebImplementationEnabled } from '../../../EnableNewWebImplementation';
|
|
15
|
-
import { RNRenderer } from '../../../RNRenderer';
|
|
16
|
-
import { useCallback, useRef, useState } from 'react';
|
|
17
15
|
import { Reanimated } from '../reanimatedWrapper';
|
|
18
16
|
import { onGestureHandlerEvent } from '../eventReceiver';
|
|
19
17
|
export const ALLOWED_PROPS = [...baseGestureHandlerWithDetectorProps, ...tapGestureHandlerProps, ...panGestureHandlerProps, ...panGestureHandlerCustomNativeProps, ...longPressGestureHandlerProps, ...forceTouchGestureHandlerProps, ...flingGestureHandlerProps, ...hoverGestureHandlerProps, ...nativeViewGestureHandlerProps];
|
|
@@ -79,51 +77,6 @@ export function checkGestureCallbacksForWorklets(gesture) {
|
|
|
79
77
|
console.warn(tagMessage(`None of the callbacks in the gesture are worklets. If you wish to run them on the JS thread use '.runOnJS(true)' modifier on the gesture to make this explicit. Otherwise, mark the callbacks as 'worklet' to run them on the UI thread.`));
|
|
80
78
|
}
|
|
81
79
|
}
|
|
82
|
-
|
|
83
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
84
|
-
export function validateDetectorChildren(ref) {
|
|
85
|
-
// Finds the first native view under the Wrap component and traverses the fiber tree upwards
|
|
86
|
-
// to check whether there is more than one native view as a pseudo-direct child of GestureDetector
|
|
87
|
-
// i.e. this is not ok:
|
|
88
|
-
// Wrap
|
|
89
|
-
// |
|
|
90
|
-
// / \
|
|
91
|
-
// / \
|
|
92
|
-
// / \
|
|
93
|
-
// / \
|
|
94
|
-
// NativeView NativeView
|
|
95
|
-
//
|
|
96
|
-
// but this is fine:
|
|
97
|
-
// Wrap
|
|
98
|
-
// |
|
|
99
|
-
// NativeView
|
|
100
|
-
// |
|
|
101
|
-
// / \
|
|
102
|
-
// / \
|
|
103
|
-
// / \
|
|
104
|
-
// / \
|
|
105
|
-
// NativeView NativeView
|
|
106
|
-
if (__DEV__ && Platform.OS !== 'web') {
|
|
107
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
108
|
-
const wrapType =
|
|
109
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
110
|
-
ref._reactInternals.elementType;
|
|
111
|
-
|
|
112
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
113
|
-
let instance = RNRenderer.findHostInstance_DEPRECATED(ref)._internalFiberInstanceHandleDEV;
|
|
114
|
-
|
|
115
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
116
|
-
while (instance && instance.elementType !== wrapType) {
|
|
117
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
118
|
-
if (instance.sibling) {
|
|
119
|
-
throw new Error('GestureDetector has more than one native view as its children. This can happen if you are using a custom component that renders multiple views, like React.Fragment. You should wrap content of GestureDetector with a <View> or <Animated.View>.');
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
|
|
123
|
-
instance = instance.return;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
80
|
export function useForceRender() {
|
|
128
81
|
const [renderState, setRenderState] = useState(false);
|
|
129
82
|
const forceRender = useCallback(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["useCallback","useRef","useState","isTestEnv","tagMessage","BaseGesture","flingGestureHandlerProps","forceTouchGestureHandlerProps","longPressGestureHandlerProps","panGestureHandlerProps","panGestureHandlerCustomNativeProps","tapGestureHandlerProps","hoverGestureHandlerProps","nativeViewGestureHandlerProps","baseGestureHandlerWithDetectorProps","isNewWebImplementationEnabled","Reanimated","onGestureHandlerEvent","ALLOWED_PROPS","emptyWorklet","wasBabelPluginEnabled","__workletHash","undefined","convertToHandlerTag","ref","handlerTag","current","extractValidHandlerTags","interactionGroup","Array","from","Set","map","filter","tag","extractGestureRelations","gesture","config","requireToFail","simultaneousWith","blocksHandlers","waitFor","simultaneousHandlers","checkGestureCallbacksForWorklets","__DEV__","runOnJS","areSomeNotWorklets","handlers","isWorklet","includes","areSomeWorklets","console","error","areAllNotWorklets","warn","useForceRender","renderState","setRenderState","forceRender","useWebEventHandlers","e","nativeEvent","onGestureHandlerStateChange"],"sourceRoot":"../../../../../src","sources":["handlers/gestures/GestureDetector/utils.ts"],"mappings":";;AAAA,SAASA,WAAW,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAErD,SAASC,SAAS,EAAEC,UAAU,QAAQ,gBAAgB;AACtD,SAAqBC,WAAW,QAAqB,YAAY;AAEjE,SAASC,wBAAwB,QAAQ,2BAA2B;AACpE,SAASC,6BAA6B,QAAQ,gCAAgC;AAC9E,SAASC,4BAA4B,QAAQ,+BAA+B;AAC5E,SACEC,sBAAsB,EACtBC,kCAAkC,QAC7B,yBAAyB;AAChC,SAASC,sBAAsB,QAAQ,yBAAyB;AAChE,SAASC,wBAAwB,QAAQ,iBAAiB;AAC1D,SAASC,6BAA6B,QAAQ,gCAAgC;AAC9E,SAEEC,mCAAmC,QAC9B,4BAA4B;AACnC,SAASC,6BAA6B,QAAQ,qCAAqC;AACnF,SAASC,UAAU,QAAQ,sBAAsB;AACjD,SAASC,qBAAqB,QAAQ,kBAAkB;AAGxD,OAAO,MAAMC,aAAa,GAAG,CAC3B,GAAGJ,mCAAmC,EACtC,GAAGH,sBAAsB,EACzB,GAAGF,sBAAsB,EACzB,GAAGC,kCAAkC,EACrC,GAAGF,4BAA4B,EAC/B,GAAGD,6BAA6B,EAChC,GAAGD,wBAAwB,EAC3B,GAAGM,wBAAwB,EAC3B,GAAGC,6BAA6B,CACjC;;AAED;AACA;AACA;AACA,SAASM,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AAC;AACJ","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDetectorUpdater.d.ts","sourceRoot":"","sources":["../../../../../src/handlers/gestures/GestureDetector/useDetectorUpdater.ts"],"names":[],"mappings":"AAAA,OAAO,KAAsB,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,eAAe,EAChB,MAAM,SAAS,CAAC;AAWjB,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,oBAAoB,EAC3B,eAAe,EAAE,oBAAoB,EACrC,gBAAgB,EAAE,WAAW,EAAE,EAC/B,aAAa,EAAE,eAAe,GAAG,WAAW,EAC5C,mBAAmB,EAAE,KAAK,CAAC,SAAS,CAAC,eAAe,CAAC,uBAK/B,OAAO,
|
|
1
|
+
{"version":3,"file":"useDetectorUpdater.d.ts","sourceRoot":"","sources":["../../../../../src/handlers/gestures/GestureDetector/useDetectorUpdater.ts"],"names":[],"mappings":"AAAA,OAAO,KAAsB,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,eAAe,EAChB,MAAM,SAAS,CAAC;AAWjB,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,oBAAoB,EAC3B,eAAe,EAAE,oBAAoB,EACrC,gBAAgB,EAAE,WAAW,EAAE,EAC/B,aAAa,EAAE,eAAe,GAAG,WAAW,EAC5C,mBAAmB,EAAE,KAAK,CAAC,SAAS,CAAC,eAAe,CAAC,uBAK/B,OAAO,UAsC9B"}
|
|
@@ -7,7 +7,6 @@ export declare function extractGestureRelations(gesture: GestureType): {
|
|
|
7
7
|
blocksHandlers: GestureRef[];
|
|
8
8
|
};
|
|
9
9
|
export declare function checkGestureCallbacksForWorklets(gesture: GestureType): void;
|
|
10
|
-
export declare function validateDetectorChildren(ref: any): void;
|
|
11
10
|
export declare function useForceRender(): () => void;
|
|
12
11
|
export declare function useWebEventHandlers(): import("react").RefObject<WebEventHandler>;
|
|
13
12
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/handlers/gestures/GestureDetector/utils.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAe,WAAW,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/handlers/gestures/GestureDetector/utils.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAe,WAAW,EAAE,MAAM,YAAY,CAAC;AAmBlE,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1C,eAAO,MAAM,aAAa,UAUzB,CAAC;AAgCF,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,WAAW;;;;EAgB3D;AAED,wBAAgB,gCAAgC,CAAC,OAAO,EAAE,WAAW,QAsCpE;AAED,wBAAgB,cAAc,eAO7B;AAED,wBAAgB,mBAAmB,+CAWlC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-gesture-handler",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.32.0",
|
|
4
4
|
"description": "Declarative API exposing native platform touch and gesture system to React Native",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "jest",
|
|
@@ -80,8 +80,8 @@
|
|
|
80
80
|
"@babel/core": "^7.25.2",
|
|
81
81
|
"@babel/preset-env": "^7.25.3",
|
|
82
82
|
"@babel/preset-typescript": "^7.12.7",
|
|
83
|
-
"@react-native/babel-preset": "0.
|
|
84
|
-
"@react-native/jest-preset": "0.
|
|
83
|
+
"@react-native/babel-preset": "0.86.0",
|
|
84
|
+
"@react-native/jest-preset": "0.86.0",
|
|
85
85
|
"@testing-library/react-native": "^12.5.1",
|
|
86
86
|
"@types/hoist-non-react-statics": "^3.3.1",
|
|
87
87
|
"@types/invariant": "^2.2.37",
|
|
@@ -103,10 +103,11 @@
|
|
|
103
103
|
"madge": "^6.1.0",
|
|
104
104
|
"prettier": "3.3.3",
|
|
105
105
|
"react": "19.2.3",
|
|
106
|
-
"react-native": "0.
|
|
106
|
+
"react-native": "0.86.0",
|
|
107
107
|
"react-native-builder-bob": "^0.40.13",
|
|
108
|
-
"react-native-reanimated": "
|
|
109
|
-
"react-
|
|
108
|
+
"react-native-reanimated": "~4.4.1",
|
|
109
|
+
"react-native-worklets": "0.9.1",
|
|
110
|
+
"react-test-renderer": "19.2.3",
|
|
110
111
|
"typescript": "~5.8.3"
|
|
111
112
|
},
|
|
112
113
|
"peerDependencies": {
|
|
@@ -1,25 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
module GestureHandlerUtils
|
|
2
|
+
module_function
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
def try_to_parse_react_native_package_json(react_native_dir)
|
|
5
|
+
react_native_package_json_path = File.join(react_native_dir, 'package.json')
|
|
6
|
+
|
|
7
|
+
if !File.exist?(react_native_package_json_path)
|
|
8
|
+
return nil
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
return JSON.parse(File.read(react_native_package_json_path))
|
|
6
12
|
end
|
|
7
13
|
|
|
8
|
-
|
|
9
|
-
|
|
14
|
+
def get_react_native_minor_version()
|
|
15
|
+
react_native_dir = File.dirname(`cd "#{Pod::Config.instance.installation_root.to_s}" && node --print "require.resolve('react-native/package.json')"`)
|
|
16
|
+
react_native_json = try_to_parse_react_native_package_json(react_native_dir)
|
|
10
17
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
18
|
+
if react_native_json == nil
|
|
19
|
+
node_modules_dir = ENV["REACT_NATIVE_NODE_MODULES_DIR"]
|
|
20
|
+
if node_modules_dir != nil
|
|
21
|
+
react_native_json = try_to_parse_react_native_package_json(File.join(node_modules_dir, 'react-native'))
|
|
22
|
+
end
|
|
23
|
+
end
|
|
14
24
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
end
|
|
25
|
+
if react_native_json == nil
|
|
26
|
+
raise '[react-native-gesture-handler] Unable to recognize your `react-native` version. Please set environmental variable with `react-native` location: `export REACT_NATIVE_NODE_MODULES_DIR="<path to react-native>" && pod install`.'
|
|
27
|
+
end
|
|
19
28
|
|
|
20
|
-
|
|
21
|
-
raise '[react-native-gesture-handler] Unable to recognize your `react-native` version. Please set environmental variable with `react-native` location: `export REACT_NATIVE_NODE_MODULES_DIR="<path to react-native>" && pod install`.'
|
|
29
|
+
return react_native_json['version'].split('.')[1].to_i
|
|
22
30
|
end
|
|
23
|
-
|
|
24
|
-
return react_native_json['version'].split('.')[1].to_i
|
|
25
31
|
end
|
|
@@ -11,8 +11,8 @@ import { attachHandlers } from './attachHandlers';
|
|
|
11
11
|
import { updateHandlers } from './updateHandlers';
|
|
12
12
|
import { needsToReattach } from './needsToReattach';
|
|
13
13
|
import { dropHandlers } from './dropHandlers';
|
|
14
|
-
import { useForceRender, validateDetectorChildren } from './utils';
|
|
15
14
|
import findNodeHandle from '../../../findNodeHandle';
|
|
15
|
+
import { useForceRender } from './utils';
|
|
16
16
|
|
|
17
17
|
// Returns a function that's responsible for updating the attached gestures
|
|
18
18
|
// If the view has changed, it will reattach the handlers to the new view
|
|
@@ -36,7 +36,6 @@ export function useDetectorUpdater(
|
|
|
36
36
|
didUnderlyingViewChange ||
|
|
37
37
|
needsToReattach(preparedGesture, gesturesToAttach)
|
|
38
38
|
) {
|
|
39
|
-
validateDetectorChildren(state.viewRef);
|
|
40
39
|
dropHandlers(preparedGesture);
|
|
41
40
|
attachHandlers({
|
|
42
41
|
preparedGesture,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useCallback, useRef, useState } from 'react';
|
|
2
2
|
|
|
3
3
|
import { isTestEnv, tagMessage } from '../../../utils';
|
|
4
4
|
import { GestureRef, BaseGesture, GestureType } from '../gesture';
|
|
@@ -18,8 +18,6 @@ import {
|
|
|
18
18
|
baseGestureHandlerWithDetectorProps,
|
|
19
19
|
} from '../../gestureHandlerCommon';
|
|
20
20
|
import { isNewWebImplementationEnabled } from '../../../EnableNewWebImplementation';
|
|
21
|
-
import { RNRenderer } from '../../../RNRenderer';
|
|
22
|
-
import { useCallback, useRef, useState } from 'react';
|
|
23
21
|
import { Reanimated } from '../reanimatedWrapper';
|
|
24
22
|
import { onGestureHandlerEvent } from '../eventReceiver';
|
|
25
23
|
import { WebEventHandler } from './types';
|
|
@@ -124,56 +122,6 @@ export function checkGestureCallbacksForWorklets(gesture: GestureType) {
|
|
|
124
122
|
}
|
|
125
123
|
}
|
|
126
124
|
|
|
127
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
128
|
-
export function validateDetectorChildren(ref: any) {
|
|
129
|
-
// Finds the first native view under the Wrap component and traverses the fiber tree upwards
|
|
130
|
-
// to check whether there is more than one native view as a pseudo-direct child of GestureDetector
|
|
131
|
-
// i.e. this is not ok:
|
|
132
|
-
// Wrap
|
|
133
|
-
// |
|
|
134
|
-
// / \
|
|
135
|
-
// / \
|
|
136
|
-
// / \
|
|
137
|
-
// / \
|
|
138
|
-
// NativeView NativeView
|
|
139
|
-
//
|
|
140
|
-
// but this is fine:
|
|
141
|
-
// Wrap
|
|
142
|
-
// |
|
|
143
|
-
// NativeView
|
|
144
|
-
// |
|
|
145
|
-
// / \
|
|
146
|
-
// / \
|
|
147
|
-
// / \
|
|
148
|
-
// / \
|
|
149
|
-
// NativeView NativeView
|
|
150
|
-
if (__DEV__ && Platform.OS !== 'web') {
|
|
151
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
152
|
-
const wrapType =
|
|
153
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
154
|
-
ref._reactInternals.elementType;
|
|
155
|
-
|
|
156
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
157
|
-
let instance =
|
|
158
|
-
RNRenderer.findHostInstance_DEPRECATED(
|
|
159
|
-
ref
|
|
160
|
-
)._internalFiberInstanceHandleDEV;
|
|
161
|
-
|
|
162
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
163
|
-
while (instance && instance.elementType !== wrapType) {
|
|
164
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
165
|
-
if (instance.sibling) {
|
|
166
|
-
throw new Error(
|
|
167
|
-
'GestureDetector has more than one native view as its children. This can happen if you are using a custom component that renders multiple views, like React.Fragment. You should wrap content of GestureDetector with a <View> or <Animated.View>.'
|
|
168
|
-
);
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
|
|
172
|
-
instance = instance.return;
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
|
|
177
125
|
export function useForceRender() {
|
|
178
126
|
const [renderState, setRenderState] = useState(false);
|
|
179
127
|
const forceRender = useCallback(() => {
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "RNRenderer", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _ReactNative.default;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
var _ReactNative = _interopRequireDefault(require("react-native/Libraries/Renderer/shims/ReactNative"));
|
|
13
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
-
//# sourceMappingURL=RNRenderer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_ReactNative","_interopRequireDefault","require","e","__esModule","default"],"sourceRoot":"../../src","sources":["RNRenderer.ts"],"mappings":";;;;;;;;;;;AAEA,IAAAA,YAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA0F,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["RNRenderer","exports","findHostInstance_DEPRECATED","_ref"],"sourceRoot":"../../src","sources":["RNRenderer.web.ts"],"mappings":";;;;;;AAAO,MAAMA,UAAU,GAAAC,OAAA,CAAAD,UAAA,GAAG;EACxBE,2BAA2B,EAAGC,IAAS,IAAK;AAC9C,CAAC","ignoreList":[]}
|
package/lib/module/RNRenderer.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["default","RNRenderer"],"sourceRoot":"../../src","sources":["RNRenderer.ts"],"mappings":";;AAAA;AACA;AACA,SAASA,OAAO,IAAIC,UAAU,QAAQ,mDAAmD","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["RNRenderer","findHostInstance_DEPRECATED","_ref"],"sourceRoot":"../../src","sources":["RNRenderer.web.ts"],"mappings":";;AAAA,OAAO,MAAMA,UAAU,GAAG;EACxBC,2BAA2B,EAAGC,IAAS,IAAK;AAC9C,CAAC","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RNRenderer.d.ts","sourceRoot":"","sources":["../../src/RNRenderer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,mDAAmD,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RNRenderer.web.d.ts","sourceRoot":"","sources":["../../src/RNRenderer.web.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU;wCACe,GAAG;CACxC,CAAC"}
|
package/src/RNRenderer.ts
DELETED
package/src/RNRenderer.web.ts
DELETED