fix(mobile): tighten song swipe action spacing
This commit is contained in:
1 file changed
+15
-7
@@ -27,6 +27,7 @@ import { scheduleOnRN } from "react-native-worklets"
|
||||
import type { SwipeRowGroup } from "@/components/ios-swipe-to-remove-row"
|
||||
|
||||
const ACTION_WIDTH = 82
|
||||
const LEADING_ACTION_WIDTH = 72
|
||||
const SPRING = { duration: 450, dampingRatio: 1 }
|
||||
|
||||
function impact() {
|
||||
@@ -109,7 +110,7 @@ export function SongSwipeRow({
|
||||
const commit =
|
||||
Math.abs(x.value) >
|
||||
Math.max(
|
||||
x.value > 0 ? ACTION_WIDTH * 2 : ACTION_WIDTH,
|
||||
x.value > 0 ? LEADING_ACTION_WIDTH * 2 : ACTION_WIDTH,
|
||||
width.value * 0.55
|
||||
)
|
||||
if (commit !== committed.value) {
|
||||
@@ -130,10 +131,13 @@ export function SongSwipeRow({
|
||||
Math.abs(x.value) > 10 && projected * side > ACTION_WIDTH / 2
|
||||
? side
|
||||
: 0
|
||||
x.value = withSpring(target * ACTION_WIDTH * (target > 0 ? 2 : 1), {
|
||||
...SPRING,
|
||||
velocity: event.velocityX,
|
||||
})
|
||||
x.value = withSpring(
|
||||
target * (target > 0 ? LEADING_ACTION_WIDTH * 2 : ACTION_WIDTH),
|
||||
{
|
||||
...SPRING,
|
||||
velocity: event.velocityX,
|
||||
}
|
||||
)
|
||||
scheduleOnRN(settle, target)
|
||||
})
|
||||
.onFinalize((_event, success) => {
|
||||
@@ -285,8 +289,12 @@ function SwipeAction({
|
||||
const resting = Math.max(
|
||||
0,
|
||||
Math.min(
|
||||
revealed - 20,
|
||||
interpolate(revealed, [24, ACTION_WIDTH, 220], [0, 62, 200])
|
||||
revealed - (side > 0 ? 10 : 20),
|
||||
interpolate(
|
||||
revealed,
|
||||
[24, side > 0 ? LEADING_ACTION_WIDTH : ACTION_WIDTH, 220],
|
||||
[0, 62, 200]
|
||||
)
|
||||
)
|
||||
)
|
||||
const pillWidth =
|
||||
|
||||
Reference in new issue
Block a user