react-native-screen-transitions 3.3.0-beta.2 → 3.3.0-beta.4
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/README.md +95 -31
- package/lib/commonjs/shared/animation/snap-to.js +17 -10
- package/lib/commonjs/shared/animation/snap-to.js.map +1 -1
- package/lib/commonjs/shared/components/create-transition-aware-component.js +20 -18
- package/lib/commonjs/shared/components/create-transition-aware-component.js.map +1 -1
- package/lib/commonjs/shared/components/screen-container.js +68 -9
- package/lib/commonjs/shared/components/screen-container.js.map +1 -1
- package/lib/commonjs/shared/constants.js +8 -1
- package/lib/commonjs/shared/constants.js.map +1 -1
- package/lib/commonjs/shared/hooks/gestures/use-build-gestures.js +49 -39
- package/lib/commonjs/shared/hooks/gestures/use-build-gestures.js.map +1 -1
- package/lib/commonjs/shared/hooks/gestures/use-screen-gesture-handlers.js +110 -61
- package/lib/commonjs/shared/hooks/gestures/use-screen-gesture-handlers.js.map +1 -1
- package/lib/commonjs/shared/hooks/gestures/use-scroll-registry.js +67 -70
- package/lib/commonjs/shared/hooks/gestures/use-scroll-registry.js.map +1 -1
- package/lib/commonjs/shared/providers/gestures.provider.js +113 -25
- package/lib/commonjs/shared/providers/gestures.provider.js.map +1 -1
- package/lib/commonjs/shared/types/ownership.types.js +71 -0
- package/lib/commonjs/shared/types/ownership.types.js.map +1 -0
- package/lib/commonjs/shared/utils/gesture/check-gesture-activation.js +72 -128
- package/lib/commonjs/shared/utils/gesture/check-gesture-activation.js.map +1 -1
- package/lib/commonjs/shared/utils/gesture/compute-claimed-directions.js +81 -0
- package/lib/commonjs/shared/utils/gesture/compute-claimed-directions.js.map +1 -0
- package/lib/commonjs/shared/utils/gesture/determine-snap-target.js +1 -1
- package/lib/commonjs/shared/utils/gesture/determine-snap-target.js.map +1 -1
- package/lib/commonjs/shared/utils/gesture/find-collapse-target.js +48 -0
- package/lib/commonjs/shared/utils/gesture/find-collapse-target.js.map +1 -0
- package/lib/commonjs/shared/utils/gesture/resolve-ownership.js +87 -0
- package/lib/commonjs/shared/utils/gesture/resolve-ownership.js.map +1 -0
- package/lib/commonjs/shared/utils/gesture/velocity.js +16 -5
- package/lib/commonjs/shared/utils/gesture/velocity.js.map +1 -1
- package/lib/module/shared/animation/snap-to.js +16 -10
- package/lib/module/shared/animation/snap-to.js.map +1 -1
- package/lib/module/shared/components/create-transition-aware-component.js +20 -18
- package/lib/module/shared/components/create-transition-aware-component.js.map +1 -1
- package/lib/module/shared/components/screen-container.js +68 -10
- package/lib/module/shared/components/screen-container.js.map +1 -1
- package/lib/module/shared/constants.js +7 -0
- package/lib/module/shared/constants.js.map +1 -1
- package/lib/module/shared/hooks/gestures/use-build-gestures.js +49 -39
- package/lib/module/shared/hooks/gestures/use-build-gestures.js.map +1 -1
- package/lib/module/shared/hooks/gestures/use-screen-gesture-handlers.js +112 -63
- package/lib/module/shared/hooks/gestures/use-screen-gesture-handlers.js.map +1 -1
- package/lib/module/shared/hooks/gestures/use-scroll-registry.js +68 -70
- package/lib/module/shared/hooks/gestures/use-scroll-registry.js.map +1 -1
- package/lib/module/shared/providers/gestures.provider.js +113 -25
- package/lib/module/shared/providers/gestures.provider.js.map +1 -1
- package/lib/module/shared/types/ownership.types.js +67 -0
- package/lib/module/shared/types/ownership.types.js.map +1 -0
- package/lib/module/shared/utils/gesture/check-gesture-activation.js +70 -126
- package/lib/module/shared/utils/gesture/check-gesture-activation.js.map +1 -1
- package/lib/module/shared/utils/gesture/compute-claimed-directions.js +77 -0
- package/lib/module/shared/utils/gesture/compute-claimed-directions.js.map +1 -0
- package/lib/module/shared/utils/gesture/determine-snap-target.js +1 -1
- package/lib/module/shared/utils/gesture/determine-snap-target.js.map +1 -1
- package/lib/module/shared/utils/gesture/find-collapse-target.js +44 -0
- package/lib/module/shared/utils/gesture/find-collapse-target.js.map +1 -0
- package/lib/module/shared/utils/gesture/resolve-ownership.js +83 -0
- package/lib/module/shared/utils/gesture/resolve-ownership.js.map +1 -0
- package/lib/module/shared/utils/gesture/velocity.js +16 -5
- package/lib/module/shared/utils/gesture/velocity.js.map +1 -1
- package/lib/typescript/shared/animation/snap-to.d.ts.map +1 -1
- package/lib/typescript/shared/components/create-transition-aware-component.d.ts.map +1 -1
- package/lib/typescript/shared/components/screen-container.d.ts.map +1 -1
- package/lib/typescript/shared/constants.d.ts +6 -0
- package/lib/typescript/shared/constants.d.ts.map +1 -1
- package/lib/typescript/shared/hooks/gestures/use-build-gestures.d.ts +15 -3
- package/lib/typescript/shared/hooks/gestures/use-build-gestures.d.ts.map +1 -1
- package/lib/typescript/shared/hooks/gestures/use-screen-gesture-handlers.d.ts +52 -2
- package/lib/typescript/shared/hooks/gestures/use-screen-gesture-handlers.d.ts.map +1 -1
- package/lib/typescript/shared/hooks/gestures/use-scroll-registry.d.ts +11 -6
- package/lib/typescript/shared/hooks/gestures/use-scroll-registry.d.ts.map +1 -1
- package/lib/typescript/shared/hooks/use-backdrop-pointer-events.d.ts +1 -1
- package/lib/typescript/shared/hooks/use-backdrop-pointer-events.d.ts.map +1 -1
- package/lib/typescript/shared/providers/gestures.provider.d.ts +28 -3
- package/lib/typescript/shared/providers/gestures.provider.d.ts.map +1 -1
- package/lib/typescript/shared/types/ownership.types.d.ts +52 -0
- package/lib/typescript/shared/types/ownership.types.d.ts.map +1 -0
- package/lib/typescript/shared/types/screen.types.d.ts +22 -1
- package/lib/typescript/shared/types/screen.types.d.ts.map +1 -1
- package/lib/typescript/shared/utils/gesture/check-gesture-activation.d.ts +23 -19
- package/lib/typescript/shared/utils/gesture/check-gesture-activation.d.ts.map +1 -1
- package/lib/typescript/shared/utils/gesture/compute-claimed-directions.d.ts +23 -0
- package/lib/typescript/shared/utils/gesture/compute-claimed-directions.d.ts.map +1 -0
- package/lib/typescript/shared/utils/gesture/determine-snap-target.d.ts +5 -1
- package/lib/typescript/shared/utils/gesture/determine-snap-target.d.ts.map +1 -1
- package/lib/typescript/shared/utils/gesture/find-collapse-target.d.ts +17 -0
- package/lib/typescript/shared/utils/gesture/find-collapse-target.d.ts.map +1 -0
- package/lib/typescript/shared/utils/gesture/resolve-ownership.d.ts +36 -0
- package/lib/typescript/shared/utils/gesture/resolve-ownership.d.ts.map +1 -0
- package/lib/typescript/shared/utils/gesture/velocity.d.ts.map +1 -1
- package/package.json +121 -120
- package/src/shared/animation/snap-to.ts +17 -11
- package/src/shared/components/create-transition-aware-component.tsx +28 -25
- package/src/shared/components/screen-container.tsx +79 -12
- package/src/shared/constants.ts +7 -0
- package/src/shared/hooks/gestures/use-build-gestures.tsx +80 -44
- package/src/shared/hooks/gestures/use-screen-gesture-handlers.ts +147 -71
- package/src/shared/hooks/gestures/use-scroll-registry.tsx +94 -86
- package/src/shared/hooks/use-backdrop-pointer-events.ts +1 -1
- package/src/shared/providers/gestures.provider.tsx +168 -25
- package/src/shared/types/ownership.types.ts +77 -0
- package/src/shared/types/screen.types.ts +24 -1
- package/src/shared/utils/gesture/check-gesture-activation.ts +82 -116
- package/src/shared/utils/gesture/compute-claimed-directions.ts +93 -0
- package/src/shared/utils/gesture/determine-snap-target.ts +6 -2
- package/src/shared/utils/gesture/find-collapse-target.ts +42 -0
- package/src/shared/utils/gesture/resolve-ownership.ts +110 -0
- package/src/shared/utils/gesture/velocity.ts +16 -6
- package/src/shared/__tests__/bounds.store.test.ts +0 -394
- package/src/shared/__tests__/derivations.test.ts +0 -156
- package/src/shared/__tests__/determine-dismissal.test.ts +0 -111
- package/src/shared/__tests__/determine-snap-target.test.ts +0 -268
- package/src/shared/__tests__/geometry.test.ts +0 -130
- package/src/shared/__tests__/gesture-activation.test.ts +0 -471
- package/src/shared/__tests__/gesture.velocity.test.ts +0 -131
- package/src/shared/__tests__/history.store.test.ts +0 -550
- package/src/shared/__tests__/sync-routes-with-removed.test.ts +0 -137
- package/src/shared/__tests__/validate-snap-points.test.ts +0 -125
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.applyOffsetRules = void 0;
|
|
7
7
|
exports.calculateSwipeDirs = calculateSwipeDirs;
|
|
8
|
-
exports.
|
|
8
|
+
exports.checkScrollBoundary = checkScrollBoundary;
|
|
9
9
|
exports.computeEdgeConstraints = computeEdgeConstraints;
|
|
10
10
|
exports.normalizeSides = normalizeSides;
|
|
11
11
|
exports.shouldActivateOrFail = shouldActivateOrFail;
|
|
@@ -232,142 +232,86 @@ const applyOffsetRules = ({
|
|
|
232
232
|
isSwipingLeft
|
|
233
233
|
};
|
|
234
234
|
};
|
|
235
|
-
|
|
235
|
+
|
|
236
236
|
/**
|
|
237
|
-
* Checks if a
|
|
238
|
-
*
|
|
237
|
+
* Checks if a ScrollView is at its boundary for the given swipe direction.
|
|
238
|
+
* This is a simplified boundary check that respects axis isolation.
|
|
239
|
+
*
|
|
240
|
+
* Per the spec:
|
|
241
|
+
* - A vertical ScrollView never yields to horizontal gestures
|
|
242
|
+
* - A horizontal ScrollView never yields to vertical gestures
|
|
243
|
+
* - ScrollView must be at boundary before yielding control
|
|
244
|
+
*
|
|
245
|
+
* For snap point sheets, the boundary depends on where the sheet originates from:
|
|
246
|
+
* - Bottom sheet (vertical): scrollY = 0 (top/base)
|
|
247
|
+
* - Top sheet (verticalInverted): scrollY >= maxY (bottom/end)
|
|
248
|
+
* - Right drawer (horizontal): scrollX = 0 (left/base)
|
|
249
|
+
* - Left drawer (horizontalInverted): scrollX >= maxX (right/end)
|
|
250
|
+
*
|
|
251
|
+
* The rule: "when the ScrollView can't scroll any further in the direction
|
|
252
|
+
* the sheet came from, yield to the gesture."
|
|
253
|
+
*
|
|
254
|
+
* @param scrollConfig - The current scroll state
|
|
255
|
+
* @param direction - The swipe direction to check
|
|
256
|
+
* @param snapAxisInverted - For snap point sheets, whether the axis is inverted (top sheet / left drawer)
|
|
257
|
+
* @returns true if at boundary (gesture should activate), false otherwise
|
|
239
258
|
*/
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
directions,
|
|
243
|
-
scrollConfig,
|
|
244
|
-
hasSnapPoints,
|
|
245
|
-
canExpandMore
|
|
246
|
-
}) {
|
|
259
|
+
exports.applyOffsetRules = applyOffsetRules;
|
|
260
|
+
function checkScrollBoundary(scrollConfig, direction, snapAxisInverted) {
|
|
247
261
|
"worklet";
|
|
248
262
|
|
|
263
|
+
if (!scrollConfig) {
|
|
264
|
+
// No scroll config means no ScrollView - allow gesture
|
|
265
|
+
return true;
|
|
266
|
+
}
|
|
249
267
|
const {
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
268
|
+
x: scrollX,
|
|
269
|
+
y: scrollY,
|
|
270
|
+
contentWidth,
|
|
271
|
+
contentHeight,
|
|
272
|
+
layoutWidth,
|
|
273
|
+
layoutHeight
|
|
274
|
+
} = scrollConfig;
|
|
255
275
|
|
|
256
|
-
//
|
|
257
|
-
const
|
|
258
|
-
const
|
|
259
|
-
const maxScrollX = scrollConfig ? scrollConfig.contentWidth - scrollConfig.layoutWidth : 0;
|
|
260
|
-
const maxScrollY = scrollConfig ? scrollConfig.contentHeight - scrollConfig.layoutHeight : 0;
|
|
261
|
-
const snapAxisInverted = directions.snapAxisInverted;
|
|
276
|
+
// Calculate max scroll values
|
|
277
|
+
const maxScrollX = Math.max(0, contentWidth - layoutWidth);
|
|
278
|
+
const maxScrollY = Math.max(0, contentHeight - layoutHeight);
|
|
262
279
|
|
|
263
|
-
//
|
|
264
|
-
//
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
// Sheet from TOP (vertical-inverted): only activate at scroll BOTTOM
|
|
272
|
-
if (scrollY >= maxScrollY) {
|
|
273
|
-
if (isSwipingUp) {
|
|
274
|
-
return {
|
|
275
|
-
shouldActivate: true,
|
|
276
|
-
direction: "vertical-inverted"
|
|
277
|
-
};
|
|
278
|
-
}
|
|
279
|
-
if (isSwipingDown && canExpandMore) {
|
|
280
|
-
return {
|
|
281
|
-
shouldActivate: true,
|
|
282
|
-
direction: "vertical"
|
|
283
|
-
};
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
} else {
|
|
287
|
-
// Sheet from BOTTOM (vertical): only activate at scroll TOP
|
|
288
|
-
if (scrollY <= 0) {
|
|
289
|
-
if (isSwipingDown) {
|
|
290
|
-
return {
|
|
291
|
-
shouldActivate: true,
|
|
292
|
-
direction: "vertical"
|
|
293
|
-
};
|
|
294
|
-
}
|
|
295
|
-
if (isSwipingUp && canExpandMore) {
|
|
296
|
-
return {
|
|
297
|
-
shouldActivate: true,
|
|
298
|
-
direction: "vertical-inverted"
|
|
299
|
-
};
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
}
|
|
280
|
+
// For snap point sheets (snapAxisInverted is defined), boundary depends on sheet origin
|
|
281
|
+
// Even if content isn't scrollable, respect bounce/overscroll state
|
|
282
|
+
if (snapAxisInverted !== undefined) {
|
|
283
|
+
const isVerticalDirection = direction === "vertical" || direction === "vertical-inverted";
|
|
284
|
+
if (isVerticalDirection) {
|
|
285
|
+
// Bottom sheet (not inverted): boundary at scroll top
|
|
286
|
+
// Top sheet (inverted): boundary at scroll bottom
|
|
287
|
+
return snapAxisInverted ? scrollY >= maxScrollY : scrollY <= 0;
|
|
303
288
|
}
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
if (isSwipingLeft) {
|
|
309
|
-
return {
|
|
310
|
-
shouldActivate: true,
|
|
311
|
-
direction: "horizontal-inverted"
|
|
312
|
-
};
|
|
313
|
-
}
|
|
314
|
-
if (isSwipingRight && canExpandMore) {
|
|
315
|
-
return {
|
|
316
|
-
shouldActivate: true,
|
|
317
|
-
direction: "horizontal"
|
|
318
|
-
};
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
} else {
|
|
322
|
-
// Sheet from RIGHT (horizontal): only activate at scroll LEFT
|
|
323
|
-
if (scrollX <= 0) {
|
|
324
|
-
if (isSwipingRight) {
|
|
325
|
-
return {
|
|
326
|
-
shouldActivate: true,
|
|
327
|
-
direction: "horizontal"
|
|
328
|
-
};
|
|
329
|
-
}
|
|
330
|
-
if (isSwipingLeft && canExpandMore) {
|
|
331
|
-
return {
|
|
332
|
-
shouldActivate: true,
|
|
333
|
-
direction: "horizontal-inverted"
|
|
334
|
-
};
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
return {
|
|
340
|
-
shouldActivate: false,
|
|
341
|
-
direction: null
|
|
342
|
-
};
|
|
289
|
+
// Horizontal direction
|
|
290
|
+
// Right drawer (not inverted): boundary at scroll left
|
|
291
|
+
// Left drawer (inverted): boundary at scroll right
|
|
292
|
+
return snapAxisInverted ? scrollX >= maxScrollX : scrollX <= 0;
|
|
343
293
|
}
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
direction: "horizontal-inverted"
|
|
366
|
-
};
|
|
294
|
+
|
|
295
|
+
// Non-sheet screens: each direction has its own boundary
|
|
296
|
+
switch (direction) {
|
|
297
|
+
case "vertical":
|
|
298
|
+
// Swipe down - check if at top of vertical scroll
|
|
299
|
+
// Even if content isn't scrollable, respect bounce/overscroll state
|
|
300
|
+
return scrollY <= 0;
|
|
301
|
+
case "vertical-inverted":
|
|
302
|
+
// Swipe up - check if at bottom of vertical scroll
|
|
303
|
+
// Even if content isn't scrollable, respect bounce/overscroll state
|
|
304
|
+
return scrollY >= maxScrollY;
|
|
305
|
+
case "horizontal":
|
|
306
|
+
// Swipe right - check if at left of horizontal scroll
|
|
307
|
+
// Even if content isn't scrollable, respect bounce/overscroll state
|
|
308
|
+
return scrollX <= 0;
|
|
309
|
+
case "horizontal-inverted":
|
|
310
|
+
// Swipe left - check if at right of horizontal scroll
|
|
311
|
+
// Even if content isn't scrollable, respect bounce/overscroll state
|
|
312
|
+
return scrollX >= maxScrollX;
|
|
313
|
+
default:
|
|
314
|
+
return true;
|
|
367
315
|
}
|
|
368
|
-
return {
|
|
369
|
-
shouldActivate: false,
|
|
370
|
-
direction: null
|
|
371
|
-
};
|
|
372
316
|
}
|
|
373
317
|
//# sourceMappingURL=check-gesture-activation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_gesture","require","GESTURE_ACTIVATION_THRESHOLD_X","GESTURE_ACTIVATION_THRESHOLD_Y","GESTURE_FAIL_TOLERANCE_X","GESTURE_FAIL_TOLERANCE_Y","DEFAULT_EDGE_DISTANCE_HORIZONTAL","DEFAULT_EDGE_DISTANCE_VERTICAL","DEFAULT_ACTIVATION_AREA","normalizeSides","area","mode","left","right","top","bottom","s","computeEdgeConstraints","initialTouch","dimensions","sides","responseDistance","xDist","yDist","horizontalRight","x","horizontalLeft","width","verticalDown","y","verticalUp","height","calculateSwipeDirs","deltaX","deltaY","isVerticalSwipe","Math","abs","isHorizontalSwipe","isSwipingDown","isSwipingUp","isSwipingRight","isSwipingLeft","shouldActivateOrFail","params","hasHorizontal","hasVertical","allowedRight","allowedLeft","allowedUp","allowedDown","horizontalGateRight","horizontalGateLeft","verticalGateUp","verticalGateDown","shouldActivate","shouldFail","hasEnoughHorizontalMovement","hasAcceptableVerticalDeviation","rightOk","leftOk","hasEnoughVerticalMovement","hasAcceptableHorizontalDeviation","upOk","downOk","applyOffsetRules","touch","directions","manager","gestureOffsetState","activationArea","vertical","verticalInverted","horizontal","horizontalInverted","value","GestureOffsetState","PENDING","PASSED","FAILED","fail","exports","
|
|
1
|
+
{"version":3,"names":["_gesture","require","GESTURE_ACTIVATION_THRESHOLD_X","GESTURE_ACTIVATION_THRESHOLD_Y","GESTURE_FAIL_TOLERANCE_X","GESTURE_FAIL_TOLERANCE_Y","DEFAULT_EDGE_DISTANCE_HORIZONTAL","DEFAULT_EDGE_DISTANCE_VERTICAL","DEFAULT_ACTIVATION_AREA","normalizeSides","area","mode","left","right","top","bottom","s","computeEdgeConstraints","initialTouch","dimensions","sides","responseDistance","xDist","yDist","horizontalRight","x","horizontalLeft","width","verticalDown","y","verticalUp","height","calculateSwipeDirs","deltaX","deltaY","isVerticalSwipe","Math","abs","isHorizontalSwipe","isSwipingDown","isSwipingUp","isSwipingRight","isSwipingLeft","shouldActivateOrFail","params","hasHorizontal","hasVertical","allowedRight","allowedLeft","allowedUp","allowedDown","horizontalGateRight","horizontalGateLeft","verticalGateUp","verticalGateDown","shouldActivate","shouldFail","hasEnoughHorizontalMovement","hasAcceptableVerticalDeviation","rightOk","leftOk","hasEnoughVerticalMovement","hasAcceptableHorizontalDeviation","upOk","downOk","applyOffsetRules","touch","directions","manager","gestureOffsetState","activationArea","vertical","verticalInverted","horizontal","horizontalInverted","value","GestureOffsetState","PENDING","PASSED","FAILED","fail","exports","checkScrollBoundary","scrollConfig","direction","snapAxisInverted","scrollX","scrollY","contentWidth","contentHeight","layoutWidth","layoutHeight","maxScrollX","max","maxScrollY","undefined","isVerticalDirection"],"sourceRoot":"../../../../../src","sources":["shared/utils/gesture/check-gesture-activation.ts"],"mappings":";;;;;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AA+DA;AACA;AACA;AACA,MAAMC,8BAA8B,GAAG,EAAE;AACzC,MAAMC,8BAA8B,GAAG,EAAE;AACzC,MAAMC,wBAAwB,GAAG,EAAE;AACnC,MAAMC,wBAAwB,GAAG,EAAE;AACnC,MAAMC,gCAAgC,GAAG,EAAE;AAC3C,MAAMC,8BAA8B,GAAG,GAAG;AAC1C,MAAMC,uBAAuB,GAAG,QAAiB;AAE1C,SAASC,cAAcA,CAACC,IAA4B,EAAmB;EAC7E,SAAS;;EACT,IAAI,CAACA,IAAI,IAAI,OAAOA,IAAI,KAA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AI,CAACyD,GAAG,CAAC,CAAC,EAAEL,YAAY,GAAGE,WAAW,CAAC;EAC1D,MAAMI,UAAU,GAAG1D,IAAI,CAACyD,GAAG,CAAC,CAAC,EAAEJ,aAAa,GAAGE,YAAY,CAAC;;EAE5D;EACA;EACA,IAAIN,gBAAgB,KAAKU,SAAS,EAAE;IACnC,MAAMC,mBAAmB,GACxBZ,SAAS,KAAK,UAAU,IAAIA,SAAS,KAAK,mBAAmB;IAE9D,IAAIY,mBAAmB,EAAE;MACxB;MACA;MACA,OAAOX,gBAAgB,GAAGE,OAAO,IAAIO,UAAU,GAAGP,OAAO,IAAI,CAAC;IAC/D;IACA;IACA;IACA;IACA,OAAOF,gBAAgB,GAAGC,OAAO,IAAIM,UAAU,GAAGN,OAAO,IAAI,CAAC;EAC/D;;EAEA;EACA,QAAQF,SAAS;IAChB,KAAK,UAAU;MACd;MACA;MACA,OAAOG,OAAO,IAAI,CAAC;IAEpB,KAAK,mBAAmB;MACvB;MACA;MACA,OAAOA,OAAO,IAAIO,UAAU;IAE7B,KAAK,YAAY;MAChB;MACA;MACA,OAAOR,OAAO,IAAI,CAAC;IAEpB,KAAK,qBAAqB;MACzB;MACA;MACA,OAAOA,OAAO,IAAIM,UAAU;IAE7B;MACC,OAAO,IAAI;EACb;AACD","ignoreList":[]}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.claimsAnyDirection = claimsAnyDirection;
|
|
7
|
+
exports.computeClaimedDirections = computeClaimedDirections;
|
|
8
|
+
var _ownership = require("../../types/ownership.types");
|
|
9
|
+
/**
|
|
10
|
+
* Computes which directions a screen claims ownership of.
|
|
11
|
+
*
|
|
12
|
+
* A screen claims a direction when:
|
|
13
|
+
* 1. gestureEnabled is true AND
|
|
14
|
+
* 2. gestureDirection includes that direction
|
|
15
|
+
*
|
|
16
|
+
* For snap points, both directions on the axis are claimed automatically.
|
|
17
|
+
* This is because a snap point sheet handles both expand (inverse) and collapse (primary) gestures.
|
|
18
|
+
*
|
|
19
|
+
* @param gestureEnabled - Whether gestures are enabled for this screen
|
|
20
|
+
* @param gestureDirection - The gesture direction(s) configured for this screen
|
|
21
|
+
* @param hasSnapPoints - Whether this screen has snap points configured
|
|
22
|
+
* @returns The claimed directions for this screen
|
|
23
|
+
*/
|
|
24
|
+
function computeClaimedDirections(gestureEnabled, gestureDirection, hasSnapPoints) {
|
|
25
|
+
// If gestures are not enabled, claim nothing
|
|
26
|
+
if (!gestureEnabled) {
|
|
27
|
+
return _ownership.NO_CLAIMS;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Default to vertical if no direction specified
|
|
31
|
+
const direction = gestureDirection ?? "vertical";
|
|
32
|
+
|
|
33
|
+
// Normalize to array
|
|
34
|
+
const directions = Array.isArray(direction) ? direction : [direction];
|
|
35
|
+
|
|
36
|
+
// Start with no claims
|
|
37
|
+
const claims = {
|
|
38
|
+
vertical: false,
|
|
39
|
+
"vertical-inverted": false,
|
|
40
|
+
horizontal: false,
|
|
41
|
+
"horizontal-inverted": false
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
// Process each direction
|
|
45
|
+
for (const dir of directions) {
|
|
46
|
+
if (dir === "bidirectional") {
|
|
47
|
+
// Bidirectional claims all four directions
|
|
48
|
+
claims.vertical = true;
|
|
49
|
+
claims["vertical-inverted"] = true;
|
|
50
|
+
claims.horizontal = true;
|
|
51
|
+
claims["horizontal-inverted"] = true;
|
|
52
|
+
} else {
|
|
53
|
+
// Claim the specific direction
|
|
54
|
+
claims[dir] = true;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// For snap points, claim both directions on the axis
|
|
59
|
+
// This enables both expand (inverse) and collapse/dismiss (primary) gestures
|
|
60
|
+
if (hasSnapPoints) {
|
|
61
|
+
const hasVerticalAxis = claims.vertical || claims["vertical-inverted"];
|
|
62
|
+
const hasHorizontalAxis = claims.horizontal || claims["horizontal-inverted"];
|
|
63
|
+
if (hasVerticalAxis) {
|
|
64
|
+
claims.vertical = true;
|
|
65
|
+
claims["vertical-inverted"] = true;
|
|
66
|
+
}
|
|
67
|
+
if (hasHorizontalAxis) {
|
|
68
|
+
claims.horizontal = true;
|
|
69
|
+
claims["horizontal-inverted"] = true;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return claims;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Checks if any direction is claimed.
|
|
77
|
+
*/
|
|
78
|
+
function claimsAnyDirection(claims) {
|
|
79
|
+
return claims.vertical || claims["vertical-inverted"] || claims.horizontal || claims["horizontal-inverted"];
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=compute-claimed-directions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_ownership","require","computeClaimedDirections","gestureEnabled","gestureDirection","hasSnapPoints","NO_CLAIMS","direction","directions","Array","isArray","claims","vertical","horizontal","dir","hasVerticalAxis","hasHorizontalAxis","claimsAnyDirection"],"sourceRoot":"../../../../../src","sources":["shared/utils/gesture/compute-claimed-directions.ts"],"mappings":";;;;;;;AACA,IAAAA,UAAA,GAAAC,OAAA;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,wBAAwBA,CACvCC,cAAuB,EACvBC,gBAAmE,EACnEC,aAAsB,EACF;EACpB;EACA,IAAI,CAACF,cAAc,EAAE;IACpB,OAAOG,oBAAS;EACjB;;EAEA;EACA,MAAMC,SAAS,GAAGH,gBAAgB,IAAI,UAAU;;EAEhD;EACA,MAAMI,UAA8B,GAAGC,KAAK,CAACC,OAAO,CAACH,SAAS,CAAC,GAC5DA,SAAS,GACT,CAACA,SAAS,CAAC;;EAEd;EACA,MAAMI,MAAyB,GAAG;IACjCC,QAAQ,EAAE,KAAK;IACf,mBAAmB,EAAE,KAAK;IAC1BC,UAAU,EAAE,KAAK;IACjB,qBAAqB,EAAE;EACxB,CAAC;;EAED;EACA,KAAK,MAAMC,GAAG,IAAIN,UAAU,EAAE;IAC7B,IAAIM,GAAG,KAAK,eAAe,EAAE;MAC5B;MACAH,MAAM,CAACC,QAAQ,GAAG,IAAI;MACtBD,MAAM,CAAC,mBAAmB,CAAC,GAAG,IAAI;MAClCA,MAAM,CAACE,UAAU,GAAG,IAAI;MACxBF,MAAM,CAAC,qBAAqB,CAAC,GAAG,IAAI;IACrC,CAAC,MAAM;MACN;MACAA,MAAM,CAACG,GAAG,CAAc,GAAG,IAAI;IAChC;EACD;;EAEA;EACA;EACA,IAAIT,aAAa,EAAE;IAClB,MAAMU,eAAe,GAAGJ,MAAM,CAACC,QAAQ,IAAID,MAAM,CAAC,mBAAmB,CAAC;IACtE,MAAMK,iBAAiB,GACtBL,MAAM,CAACE,UAAU,IAAIF,MAAM,CAAC,qBAAqB,CAAC;IAEnD,IAAII,eAAe,EAAE;MACpBJ,MAAM,CAACC,QAAQ,GAAG,IAAI;MACtBD,MAAM,CAAC,mBAAmB,CAAC,GAAG,IAAI;IACnC;IACA,IAAIK,iBAAiB,EAAE;MACtBL,MAAM,CAACE,UAAU,GAAG,IAAI;MACxBF,MAAM,CAAC,qBAAqB,CAAC,GAAG,IAAI;IACrC;EACD;EAEA,OAAOA,MAAM;AACd;;AAEA;AACA;AACA;AACO,SAASM,kBAAkBA,CAACN,MAAyB,EAAW;EACtE,OACCA,MAAM,CAACC,QAAQ,IACfD,MAAM,CAAC,mBAAmB,CAAC,IAC3BA,MAAM,CAACE,UAAU,IACjBF,MAAM,CAAC,qBAAqB,CAAC;AAE/B","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["determineSnapTarget","currentProgress","snapPoints","velocity","dimension","velocityFactor","canDismiss","velocityInProgress","projectedProgress","allTargets","sort","a","b","targetProgress","i","length","current","next","undefined","midpoint","shouldDismiss"],"sourceRoot":"../../../../../src","sources":["shared/utils/gesture/determine-snap-target.ts"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"names":["determineSnapTarget","currentProgress","snapPoints","velocity","dimension","velocityFactor","canDismiss","velocityInProgress","projectedProgress","allTargets","sort","a","b","targetProgress","i","length","current","next","undefined","midpoint","shouldDismiss"],"sourceRoot":"../../../../../src","sources":["shared/utils/gesture/determine-snap-target.ts"],"mappings":";;;;;;AAsBA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,mBAAmBA,CAAC;EACnCC,eAAe;EACfC,UAAU;EACVC,QAAQ;EACRC,SAAS;EACTC,cAAc,GAAG,GAAG;EACpBC,UAAU,GAAG;AACY,CAAC,EAA6B;EACvD,SAAS;;EAET;EACA,MAAMC,kBAAkB,GAAIJ,QAAQ,GAAGC,SAAS,GAAIC,cAAc;;EAElE;EACA,MAAMG,iBAAiB,GAAGP,eAAe,GAAGM,kBAAkB;;EAE9D;EACA,MAAME,UAAU,GAAGH,UAAU,GAC1B,CAAC,CAAC,EAAE,GAAGJ,UAAU,CAAC,CAACQ,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAKD,CAAC,GAAGC,CAAC,CAAC,GACxC,CAAC,GAAGV,UAAU,CAAC,CAACQ,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAKD,CAAC,GAAGC,CAAC,CAAC;;EAExC;EACA;EACA,IAAIC,cAAc,GAAGJ,UAAU,CAAC,CAAC,CAAC;EAElC,KAAK,IAAIK,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGL,UAAU,CAACM,MAAM,EAAED,CAAC,EAAE,EAAE;IAC3C,MAAME,OAAO,GAAGP,UAAU,CAACK,CAAC,CAAC;IAC7B,MAAMG,IAAI,GAAGR,UAAU,CAACK,CAAC,GAAG,CAAC,CAAC;IAE9B,IAAIG,IAAI,KAAKC,SAAS,EAAE;MACvB;MACAL,cAAc,GAAGG,OAAO;MACxB;IACD;IAEA,MAAMG,QAAQ,GAAG,CAACH,OAAO,GAAGC,IAAI,IAAI,CAAC;IAErC,IAAIT,iBAAiB,GAAGW,QAAQ,EAAE;MACjCN,cAAc,GAAGG,OAAO;MACxB;IACD;IAEAH,cAAc,GAAGI,IAAI;EACtB;EAEA,OAAO;IACNJ,cAAc;IACdO,aAAa,EAAEP,cAAc,KAAK;EACnC,CAAC;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.findCollapseTarget = findCollapseTarget;
|
|
7
|
+
var _constants = require("../../constants");
|
|
8
|
+
/**
|
|
9
|
+
* Finds the next lower snap point for backdrop collapse behavior.
|
|
10
|
+
*
|
|
11
|
+
* - If above min snap: returns next lower snap point
|
|
12
|
+
* - If at or below min snap: returns 0 (dismiss) if canDismiss, else stays at min
|
|
13
|
+
*
|
|
14
|
+
* @param currentProgress - Current animation progress
|
|
15
|
+
* @param snapPoints - Array of snap points
|
|
16
|
+
* @param canDismiss - Whether dismissing is allowed
|
|
17
|
+
*/
|
|
18
|
+
function findCollapseTarget(currentProgress, snapPoints, canDismiss) {
|
|
19
|
+
"worklet";
|
|
20
|
+
|
|
21
|
+
const sorted = [...snapPoints].sort((a, b) => a - b);
|
|
22
|
+
const minSnap = sorted[0];
|
|
23
|
+
|
|
24
|
+
// Find next lower snap point
|
|
25
|
+
for (let i = sorted.length - 1; i >= 0; i--) {
|
|
26
|
+
if (sorted[i] < currentProgress - _constants.EPSILON) {
|
|
27
|
+
return {
|
|
28
|
+
target: sorted[i],
|
|
29
|
+
shouldDismiss: false
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// At or below min snap → dismiss if allowed
|
|
35
|
+
if (canDismiss) {
|
|
36
|
+
return {
|
|
37
|
+
target: 0,
|
|
38
|
+
shouldDismiss: true
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Can't dismiss, stay at min
|
|
43
|
+
return {
|
|
44
|
+
target: minSnap,
|
|
45
|
+
shouldDismiss: false
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=find-collapse-target.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_constants","require","findCollapseTarget","currentProgress","snapPoints","canDismiss","sorted","sort","a","b","minSnap","i","length","EPSILON","target","shouldDismiss"],"sourceRoot":"../../../../../src","sources":["shared/utils/gesture/find-collapse-target.ts"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,kBAAkBA,CACjCC,eAAuB,EACvBC,UAAoB,EACpBC,UAAmB,EACQ;EAC3B,SAAS;;EAET,MAAMC,MAAM,GAAG,CAAC,GAAGF,UAAU,CAAC,CAACG,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAKD,CAAC,GAAGC,CAAC,CAAC;EACpD,MAAMC,OAAO,GAAGJ,MAAM,CAAC,CAAC,CAAC;;EAEzB;EACA,KAAK,IAAIK,CAAC,GAAGL,MAAM,CAACM,MAAM,GAAG,CAAC,EAAED,CAAC,IAAI,CAAC,EAAEA,CAAC,EAAE,EAAE;IAC5C,IAAIL,MAAM,CAACK,CAAC,CAAC,GAAGR,eAAe,GAAGU,kBAAO,EAAE;MAC1C,OAAO;QAAEC,MAAM,EAAER,MAAM,CAACK,CAAC,CAAC;QAAEI,aAAa,EAAE;MAAM,CAAC;IACnD;EACD;;EAEA;EACA,IAAIV,UAAU,EAAE;IACf,OAAO;MAAES,MAAM,EAAE,CAAC;MAAEC,aAAa,EAAE;IAAK,CAAC;EAC1C;;EAEA;EACA,OAAO;IAAED,MAAM,EAAEJ,OAAO;IAAEK,aAAa,EAAE;EAAM,CAAC;AACjD","ignoreList":[]}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.findNearestOwner = findNearestOwner;
|
|
7
|
+
exports.resolveOwnership = resolveOwnership;
|
|
8
|
+
var _ownership = require("../../types/ownership.types");
|
|
9
|
+
/**
|
|
10
|
+
* Minimal interface for ancestor context needed for ownership resolution.
|
|
11
|
+
* This allows the function to be used without importing the full GestureContextType.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Resolves ownership status for all directions relative to the current screen.
|
|
16
|
+
*
|
|
17
|
+
* For each direction:
|
|
18
|
+
* 1. If the current screen claims it → 'self' (should activate)
|
|
19
|
+
* 2. Else, walk up ancestors looking for a claim → 'ancestor' (should fail to bubble)
|
|
20
|
+
* 3. If no one claims it → 'none' (should fail, no gesture response)
|
|
21
|
+
*
|
|
22
|
+
* This is computed during render (JS thread) and the result can be safely
|
|
23
|
+
* used in worklets since it's a plain object.
|
|
24
|
+
*
|
|
25
|
+
* @param selfClaims - The directions claimed by the current screen
|
|
26
|
+
* @param ancestorContext - The ancestor context chain (can be null if no ancestors)
|
|
27
|
+
* @returns Ownership status for all four directions
|
|
28
|
+
*/
|
|
29
|
+
function resolveOwnership(selfClaims, ancestorContext) {
|
|
30
|
+
const result = {
|
|
31
|
+
..._ownership.NO_OWNERSHIP
|
|
32
|
+
};
|
|
33
|
+
for (const direction of _ownership.DIRECTIONS) {
|
|
34
|
+
result[direction] = resolveDirectionOwnership(direction, selfClaims, ancestorContext);
|
|
35
|
+
}
|
|
36
|
+
return result;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Resolves ownership for a single direction.
|
|
41
|
+
*/
|
|
42
|
+
function resolveDirectionOwnership(direction, selfClaims, ancestorContext) {
|
|
43
|
+
// Check self first
|
|
44
|
+
if (selfClaims[direction]) {
|
|
45
|
+
return "self";
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Walk ancestors looking for a claim
|
|
49
|
+
let ancestor = ancestorContext;
|
|
50
|
+
while (ancestor) {
|
|
51
|
+
if (ancestor.claimedDirections?.[direction]) {
|
|
52
|
+
return "ancestor";
|
|
53
|
+
}
|
|
54
|
+
ancestor = ancestor.ancestorContext;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// No one claims this direction
|
|
58
|
+
return "none";
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Finds the nearest ancestor (or self if isCurrentOwner) that claims any direction.
|
|
63
|
+
* Used for setting up native gesture relationships.
|
|
64
|
+
*
|
|
65
|
+
* @param selfClaimsAny - Whether the current screen claims any direction
|
|
66
|
+
* @param ancestorContext - The ancestor context chain
|
|
67
|
+
* @returns The nearest context that claims a direction, or null
|
|
68
|
+
*/
|
|
69
|
+
function findNearestOwner(selfClaimsAny, ancestorContext) {
|
|
70
|
+
// If self claims any direction, self is the nearest owner
|
|
71
|
+
// (but we return null since this is used for finding ANCESTOR owners)
|
|
72
|
+
if (selfClaimsAny) {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Walk ancestors looking for one that claims any direction
|
|
77
|
+
let ancestor = ancestorContext;
|
|
78
|
+
while (ancestor) {
|
|
79
|
+
const claims = ancestor.claimedDirections;
|
|
80
|
+
if (claims?.vertical || claims?.["vertical-inverted"] || claims?.horizontal || claims?.["horizontal-inverted"]) {
|
|
81
|
+
return ancestor;
|
|
82
|
+
}
|
|
83
|
+
ancestor = ancestor.ancestorContext;
|
|
84
|
+
}
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=resolve-ownership.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_ownership","require","resolveOwnership","selfClaims","ancestorContext","result","NO_OWNERSHIP","direction","DIRECTIONS","resolveDirectionOwnership","ancestor","claimedDirections","findNearestOwner","selfClaimsAny","claims","vertical","horizontal"],"sourceRoot":"../../../../../src","sources":["shared/utils/gesture/resolve-ownership.ts"],"mappings":";;;;;;;AACA,IAAAA,UAAA,GAAAC,OAAA;AAOA;AACA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,gBAAgBA,CAC/BC,UAA6B,EAC7BC,eAA6C,EACxB;EACrB,MAAMC,MAA0B,GAAG;IAAE,GAAGC;EAAa,CAAC;EAEtD,KAAK,MAAMC,SAAS,IAAIC,qBAAU,EAAE;IACnCH,MAAM,CAACE,SAAS,CAAC,GAAGE,yBAAyB,CAC5CF,SAAS,EACTJ,UAAU,EACVC,eACD,CAAC;EACF;EAEA,OAAOC,MAAM;AACd;;AAEA;AACA;AACA;AACA,SAASI,yBAAyBA,CACjCF,SAAoB,EACpBJ,UAA6B,EAC7BC,eAA6C,EAC3B;EAClB;EACA,IAAID,UAAU,CAACI,SAAS,CAAC,EAAE;IAC1B,OAAO,MAAM;EACd;;EAEA;EACA,IAAIG,QAAQ,GAAGN,eAAe;EAC9B,OAAOM,QAAQ,EAAE;IAChB,IAAIA,QAAQ,CAACC,iBAAiB,GAAGJ,SAAS,CAAC,EAAE;MAC5C,OAAO,UAAU;IAClB;IACAG,QAAQ,GAAGA,QAAQ,CAACN,eAAe;EACpC;;EAEA;EACA,OAAO,MAAM;AACd;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASQ,gBAAgBA,CAC/BC,aAAsB,EACtBT,eAA6C,EACd;EAC/B;EACA;EACA,IAAIS,aAAa,EAAE;IAClB,OAAO,IAAI;EACZ;;EAEA;EACA,IAAIH,QAAQ,GAAGN,eAAe;EAC9B,OAAOM,QAAQ,EAAE;IAChB,MAAMI,MAAM,GAAGJ,QAAQ,CAACC,iBAAiB;IACzC,IACCG,MAAM,EAAEC,QAAQ,IAChBD,MAAM,GAAG,mBAAmB,CAAC,IAC7BA,MAAM,EAAEE,UAAU,IAClBF,MAAM,GAAG,qBAAqB,CAAC,EAC9B;MACD,OAAOJ,QAAQ;IAChB;IACAA,QAAQ,GAAGA,QAAQ,CAACN,eAAe;EACpC;EAEA,OAAO,IAAI;AACZ","ignoreList":[]}
|
|
@@ -5,8 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.velocity = void 0;
|
|
7
7
|
var _reactNativeReanimated = require("react-native-reanimated");
|
|
8
|
+
var _constants = require("../../constants");
|
|
8
9
|
const MAX_VELOCITY_MAGNITUDE = 3.2;
|
|
9
|
-
const NEAR_ZERO_THRESHOLD = 0.01;
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Converts velocity from pixels/second to normalized units/second (0-1 range)
|
|
@@ -35,7 +35,7 @@ const normalizeTranslation = (translation, dimension) => {
|
|
|
35
35
|
const calculateRestoreVelocity = (currentValueNormalized, baseVelocityNormalized) => {
|
|
36
36
|
"worklet";
|
|
37
37
|
|
|
38
|
-
if (Math.abs(currentValueNormalized) <
|
|
38
|
+
if (Math.abs(currentValueNormalized) < _constants.ANIMATION_SNAP_THRESHOLD) return 0;
|
|
39
39
|
const directionTowardZero = Math.sign(currentValueNormalized) || 1;
|
|
40
40
|
const clampedVelocity = Math.min(Math.abs(baseVelocityNormalized), 1);
|
|
41
41
|
return -directionTowardZero * clampedVelocity;
|
|
@@ -84,11 +84,22 @@ const shouldPassDismissalThreshold = (translationPixels, velocityPixelsPerSecond
|
|
|
84
84
|
"worklet";
|
|
85
85
|
|
|
86
86
|
const normalizedTranslation = translationPixels / Math.max(1, screenSize);
|
|
87
|
+
|
|
88
|
+
// If translation is essentially zero, velocity alone shouldn't trigger dismissal.
|
|
89
|
+
// User must have meaningfully moved in the dismiss direction.
|
|
90
|
+
if (Math.abs(normalizedTranslation) < _constants.EPSILON) {
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
87
93
|
const normalizedVelocity = normalize(velocityPixelsPerSecond, screenSize);
|
|
88
94
|
const projectedNormalizedPosition = normalizedTranslation + normalizedVelocity * velocityWeight;
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
95
|
+
|
|
96
|
+
// The dismiss direction is determined by the sign of the translation.
|
|
97
|
+
// Multiplying by this sign normalizes the projection so "toward dismiss" is always positive.
|
|
98
|
+
// This prevents dismissal when the user drags back (opposing velocity flips projection negative).
|
|
99
|
+
const dismissSign = Math.sign(translationPixels);
|
|
100
|
+
const projectedInDismissDirection = projectedNormalizedPosition * dismissSign;
|
|
101
|
+
const exceedsThreshold = projectedInDismissDirection > 0.5;
|
|
102
|
+
return exceedsThreshold;
|
|
92
103
|
};
|
|
93
104
|
const velocity = exports.velocity = {
|
|
94
105
|
normalize,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNativeReanimated","require","
|
|
1
|
+
{"version":3,"names":["_reactNativeReanimated","require","_constants","MAX_VELOCITY_MAGNITUDE","normalize","velocityPixelsPerSecond","screenSize","clamp","Math","max","normalizeTranslation","translation","dimension","calculateRestoreVelocity","currentValueNormalized","baseVelocityNormalized","abs","ANIMATION_SNAP_THRESHOLD","directionTowardZero","sign","clampedVelocity","min","calculateProgressVelocity","animations","shouldDismiss","event","dimensions","directions","currentProgress","progress","value","targetProgress","progressDelta","progressDirection","normalizedVelocityX","velocityX","width","normalizedVelocityY","velocityY","height","normalizedTranslationX","translationX","normalizedTranslationY","translationY","supportsHorizontalGestures","horizontal","horizontalInverted","supportsVerticalGestures","vertical","verticalInverted","progressVelocityMagnitude","shouldPassDismissalThreshold","translationPixels","velocityWeight","normalizedTranslation","EPSILON","normalizedVelocity","projectedNormalizedPosition","dismissSign","projectedInDismissDirection","exceedsThreshold","velocity","exports"],"sourceRoot":"../../../../../src","sources":["shared/utils/gesture/velocity.ts"],"mappings":";;;;;;AAIA,IAAAA,sBAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAA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