From bd21655b2ee39f75d63dcd502b5db750e33e1a59 Mon Sep 17 00:00:00 2001 From: Joshua Higgins Date: Sun, 15 Nov 2026 16:07:49 -0500 Subject: [PATCH 1/5] feat(mobile): add songs to queue with a full swipe --- .../app/(app)/(tabs)/home/album/[id].tsx | 1 + .../app/(app)/(tabs)/home/playlist/[id].tsx | 1 + apps/mobile/components/player.tsx | 3 + apps/mobile/components/song-swipe-row.tsx | 70 +++++++++++++++---- 4 files changed, 63 insertions(+), 12 deletions(-) diff --git a/apps/mobile/app/(app)/(tabs)/home/album/[id].tsx b/apps/mobile/app/(app)/(tabs)/home/album/[id].tsx index a32bf8c..cbba238 100644 --- a/apps/mobile/app/(app)/(tabs)/home/album/[id].tsx +++ b/apps/mobile/app/(app)/(tabs)/home/album/[id].tsx @@ -523,6 +523,7 @@ const AlbumTrackRow = memo(function AlbumTrackRow({ group={swipeGroup} backgroundColor={palette.background} onPlayNext={() => void onAction(track, album, "play-next")} + onAddToQueue={() => void onAction(track, album, "play-last")} style={styles.trackRow} onPress={() => void onPlay(track.id as Id<"songs">, songIds)} > diff --git a/apps/mobile/app/(app)/(tabs)/home/playlist/[id].tsx b/apps/mobile/app/(app)/(tabs)/home/playlist/[id].tsx index f11a0d1..8e6c50c 100644 --- a/apps/mobile/app/(app)/(tabs)/home/playlist/[id].tsx +++ b/apps/mobile/app/(app)/(tabs)/home/playlist/[id].tsx @@ -439,6 +439,7 @@ const PlaylistSongRow = memo(function PlaylistSongRow({ group: swipeGroup, backgroundColor: palette.background, onPlayNext: () => onAction(song, "play-next"), + onAddToQueue: () => onAction(song, "play-last"), } : undefined } diff --git a/apps/mobile/components/player.tsx b/apps/mobile/components/player.tsx index 0aaf866..4690ab9 100644 --- a/apps/mobile/components/player.tsx +++ b/apps/mobile/components/player.tsx @@ -45,6 +45,7 @@ export const SongRow = memo(function SongRow({ swipe?: { group: SwipeRowGroup onPlayNext: () => void + onAddToQueue: () => void backgroundColor: string } /** Album/playlist layout: the divider starts at the title, not the artwork. */ @@ -111,6 +112,7 @@ export const SongRow = memo(function SongRow({ void + onAddToQueue: () => void backgroundColor: string } onPlay: (song: BrowseSong) => void diff --git a/apps/mobile/components/song-swipe-row.tsx b/apps/mobile/components/song-swipe-row.tsx index 3e2f044..f61484a 100644 --- a/apps/mobile/components/song-swipe-row.tsx +++ b/apps/mobile/components/song-swipe-row.tsx @@ -41,6 +41,7 @@ export function SongSwipeRow({ group, onPress, onPlayNext, + onAddToQueue, }: { children: ReactNode style?: StyleProp @@ -48,6 +49,7 @@ export function SongSwipeRow({ group: SwipeRowGroup onPress?: () => void onPlayNext: () => void + onAddToQueue: () => void }) { const x = useSharedValue(0) const startX = useSharedValue(0) @@ -78,10 +80,10 @@ export function SongSwipeRow({ const activate = useCallback( (side: number) => { close() - if (side > 0) onPlayNext() + if (side > 0) onAddToQueue() // Download is intentionally a placeholder. }, - [close, onPlayNext] + [close, onAddToQueue] ) const tapRow = useCallback(() => { if (open) close() @@ -105,7 +107,11 @@ export function SongSwipeRow({ Math.min(width.value, startX.value + event.translationX) ) const commit = - Math.abs(x.value) > Math.max(ACTION_WIDTH, width.value * 0.55) + Math.abs(x.value) > + Math.max( + x.value > 0 ? ACTION_WIDTH * 2 : ACTION_WIDTH, + width.value * 0.55 + ) if (commit !== committed.value) { committed.value = commit commitProgress.value = withSpring(commit ? 1 : 0, SPRING) @@ -124,7 +130,7 @@ export function SongSwipeRow({ Math.abs(x.value) > 10 && projected * side > ACTION_WIDTH / 2 ? side : 0 - x.value = withSpring(target * ACTION_WIDTH, { + x.value = withSpring(target * ACTION_WIDTH * (target > 0 ? 2 : 1), { ...SPRING, velocity: event.velocityX, }) @@ -190,6 +196,18 @@ export function SongSwipeRow({ open={open === 1} onPress={() => activate(1)} /> + { + close() + onPlayNext() + }} + /> { - if (event.nativeEvent.actionName === "playNext") activate(1) + if (event.nativeEvent.actionName === "addToQueue") activate(1) + if (event.nativeEvent.actionName === "playNext") { + close() + onPlayNext() + } }} style={[styles.row, { backgroundColor }, rowStyle]} > @@ -225,6 +248,7 @@ export function SongSwipeRow({ function SwipeAction({ side, + secondary = false, x, height, progress, @@ -232,17 +256,32 @@ function SwipeAction({ onPress, }: { side: 1 | -1 + secondary?: boolean x: SharedValue height: SharedValue progress: SharedValue open: boolean onPress: () => void }) { - const actionStyle = useAnimatedStyle(() => ({ - width: Math.max(0, x.value * side), - })) - const pillStyle = useAnimatedStyle(() => { + const actionStyle = useAnimatedStyle(() => { const revealed = Math.max(0, x.value * side) + const primaryWidth = (revealed * (1 + progress.value)) / 2 + return { + width: + side < 0 + ? revealed + : secondary + ? revealed - primaryWidth + : primaryWidth, + ...(secondary ? { left: primaryWidth } : {}), + } + }) + const pillStyle = useAnimatedStyle(() => { + const total = Math.max(0, x.value * side) + const revealed = + side < 0 + ? total + : (total * (secondary ? 1 - progress.value : 1 + progress.value)) / 2 const resting = Math.max( 0, Math.min( @@ -292,14 +331,19 @@ function SwipeAction({ > 0 ? "Play Next" : "Download"} + accessibilityLabel={ + side > 0 ? (secondary ? "Play Next" : "Add to Queue") : "Download" + } onPress={onPress} style={styles.actionButton} > 0 ? "#6b5bff" : "#008dff" }, + { + backgroundColor: + side > 0 ? (secondary ? "#6b5bff" : "#f29943") : "#008dff", + }, pillStyle, ]} > @@ -307,7 +351,9 @@ function SwipeAction({ 0 - ? "text.line.first.and.arrowtriangle.forward" + ? secondary + ? "text.line.first.and.arrowtriangle.forward" + : "text.line.last.and.arrowtriangle.forward" : "arrow.down" } size={22} -- 2.54.1 From d941e745c9299f9467bb4f4a2b730e77b04f6db2 Mon Sep 17 00:00:00 2001 From: Joshua Higgins Date: Sun, 15 Nov 2026 16:09:10 -0500 Subject: [PATCH 2/5] fix(mobile): tighten song swipe action spacing --- apps/mobile/components/song-swipe-row.tsx | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/apps/mobile/components/song-swipe-row.tsx b/apps/mobile/components/song-swipe-row.tsx index f61484a..7ac903b 100644 --- a/apps/mobile/components/song-swipe-row.tsx +++ b/apps/mobile/components/song-swipe-row.tsx @@ -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 = -- 2.54.1 From 6d554cd30c909a90adf0ea9b4846a23153d4c1fb Mon Sep 17 00:00:00 2001 From: Joshua Higgins Date: Sun, 15 Nov 2026 17:29:33 -0500 Subject: [PATCH 3/5] feat(mobile): add flat song swipe actions on Android --- .../app/(app)/(tabs)/home/album/[id].tsx | 2 +- .../app/(app)/(tabs)/home/playlist/[id].tsx | 10 +- apps/mobile/components/player.tsx | 5 +- apps/mobile/components/song-swipe-row.tsx | 141 ++++++++++++++---- 4 files changed, 121 insertions(+), 37 deletions(-) diff --git a/apps/mobile/app/(app)/(tabs)/home/album/[id].tsx b/apps/mobile/app/(app)/(tabs)/home/album/[id].tsx index cbba238..512fccd 100644 --- a/apps/mobile/app/(app)/(tabs)/home/album/[id].tsx +++ b/apps/mobile/app/(app)/(tabs)/home/album/[id].tsx @@ -488,7 +488,7 @@ const AlbumTrackRow = memo(function AlbumTrackRow({ action: MediaAction ) => Promise }) { - const Row = Platform.OS === "ios" ? SongSwipeRow : Pressable + const Row = Platform.OS !== "web" ? SongSwipeRow : Pressable const { config } = useServerConfig() return ( onAction(song, "play-next"), onAddToQueue: () => onAction(song, "play-last"), + onRemove: + Platform.OS === "android" && removable + ? () => { + void onRemove(song.id) + } + : undefined, } : undefined } @@ -448,7 +454,7 @@ const PlaylistSongRow = memo(function PlaylistSongRow({ /> ) - if (Platform.OS === "ios" || !removable) { + if (Platform.OS !== "web" || !removable) { return row } diff --git a/apps/mobile/components/player.tsx b/apps/mobile/components/player.tsx index 4690ab9..3c77866 100644 --- a/apps/mobile/components/player.tsx +++ b/apps/mobile/components/player.tsx @@ -46,6 +46,7 @@ export const SongRow = memo(function SongRow({ group: SwipeRowGroup onPlayNext: () => void onAddToQueue: () => void + onRemove?: () => void backgroundColor: string } /** Album/playlist layout: the divider starts at the title, not the artwork. */ @@ -108,11 +109,12 @@ export const SongRow = memo(function SongRow({ ? styles.insetRow : [styles.row, { borderBottomColor: divider }] const row = - swipe && Platform.OS === "ios" ? ( + swipe && Platform.OS !== "web" ? ( void onAddToQueue: () => void + onRemove?: () => void backgroundColor: string } onPlay: (song: BrowseSong) => void diff --git a/apps/mobile/components/song-swipe-row.tsx b/apps/mobile/components/song-swipe-row.tsx index 7ac903b..e19973e 100644 --- a/apps/mobile/components/song-swipe-row.tsx +++ b/apps/mobile/components/song-swipe-row.tsx @@ -1,3 +1,4 @@ +import { Ionicons } from "@expo/vector-icons" import * as Haptics from "expo-haptics" import { SymbolView } from "expo-symbols" import { @@ -8,6 +9,7 @@ import { type ReactNode, } from "react" import { + Platform, Pressable, StyleSheet, type StyleProp, @@ -26,6 +28,8 @@ import Animated, { import { scheduleOnRN } from "react-native-worklets" import type { SwipeRowGroup } from "@/components/ios-swipe-to-remove-row" +const IS_ANDROID = Platform.OS === "android" + const ACTION_WIDTH = 82 const LEADING_ACTION_WIDTH = 72 const SPRING = { duration: 450, dampingRatio: 1 } @@ -43,6 +47,7 @@ export function SongSwipeRow({ onPress, onPlayNext, onAddToQueue, + onRemove, }: { children: ReactNode style?: StyleProp @@ -51,7 +56,9 @@ export function SongSwipeRow({ onPress?: () => void onPlayNext: () => void onAddToQueue: () => void + onRemove?: () => void }) { + const hasRemove = IS_ANDROID && !!onRemove const x = useSharedValue(0) const startX = useSharedValue(0) const width = useSharedValue(0) @@ -110,7 +117,9 @@ export function SongSwipeRow({ const commit = Math.abs(x.value) > Math.max( - x.value > 0 ? LEADING_ACTION_WIDTH * 2 : ACTION_WIDTH, + x.value > 0 + ? LEADING_ACTION_WIDTH * 2 + : ACTION_WIDTH * (hasRemove ? 2 : 1), width.value * 0.55 ) if (commit !== committed.value) { @@ -132,7 +141,10 @@ export function SongSwipeRow({ ? side : 0 x.value = withSpring( - target * (target > 0 ? LEADING_ACTION_WIDTH * 2 : ACTION_WIDTH), + target * + (target > 0 + ? LEADING_ACTION_WIDTH * 2 + : ACTION_WIDTH * (hasRemove ? 2 : 1)), { ...SPRING, velocity: event.velocityX, @@ -155,6 +167,7 @@ export function SongSwipeRow({ return Gesture.Exclusive(pan, tap) }, [ activate, + hasRemove, begin, close, commitProgress, @@ -168,12 +181,14 @@ export function SongSwipeRow({ const rowStyle = useAnimatedStyle(() => ({ transform: [{ translateX: x.value }], - borderRadius: interpolate( - Math.abs(x.value), - [0, 40], - [0, height.value / 2], - Extrapolation.CLAMP - ), + borderRadius: IS_ANDROID + ? 0 + : interpolate( + Math.abs(x.value), + [0, 40], + [0, height.value / 2], + Extrapolation.CLAMP + ), })) const fillStyle = useAnimatedStyle(() => ({ opacity: interpolate( @@ -212,8 +227,25 @@ export function SongSwipeRow({ onPlayNext() }} /> + {hasRemove && ( + { + close() + onRemove?.() + }} + /> + )} { + if (event.nativeEvent.actionName === "remove" && hasRemove) { + close() + onRemove?.() + } if (event.nativeEvent.actionName === "addToQueue") activate(1) if (event.nativeEvent.actionName === "playNext") { close() @@ -253,6 +292,8 @@ export function SongSwipeRow({ function SwipeAction({ side, secondary = false, + paired = side > 0, + remove = false, x, height, progress, @@ -261,6 +302,8 @@ function SwipeAction({ }: { side: 1 | -1 secondary?: boolean + paired?: boolean + remove?: boolean x: SharedValue height: SharedValue progress: SharedValue @@ -271,21 +314,26 @@ function SwipeAction({ const revealed = Math.max(0, x.value * side) const primaryWidth = (revealed * (1 + progress.value)) / 2 return { - width: - side < 0 - ? revealed - : secondary - ? revealed - primaryWidth - : primaryWidth, - ...(secondary ? { left: primaryWidth } : {}), + width: !paired + ? revealed + : secondary + ? revealed - primaryWidth + : primaryWidth, + ...(secondary + ? side > 0 + ? { left: primaryWidth } + : { right: primaryWidth } + : {}), } }) const pillStyle = useAnimatedStyle(() => { const total = Math.max(0, x.value * side) - const revealed = - side < 0 - ? total - : (total * (secondary ? 1 - progress.value : 1 + progress.value)) / 2 + const revealed = !paired + ? total + : (total * (secondary ? 1 - progress.value : 1 + progress.value)) / 2 + if (IS_ANDROID) { + return { width: revealed, height: height.value, borderRadius: 0 } + } const resting = Math.max( 0, Math.min( @@ -340,7 +388,13 @@ function SwipeAction({ 0 ? (secondary ? "Play Next" : "Add to Queue") : "Download" + remove + ? "Remove from Playlist" + : side > 0 + ? secondary + ? "Play Next" + : "Add to Queue" + : "Download" } onPress={onPress} style={styles.actionButton} @@ -349,24 +403,45 @@ function SwipeAction({ style={[ styles.pill, { - backgroundColor: - side > 0 ? (secondary ? "#6b5bff" : "#f29943") : "#008dff", + backgroundColor: remove + ? "#d32f2f" + : side > 0 + ? secondary + ? "#6b5bff" + : "#f29943" + : "#008dff", }, pillStyle, ]} > - 0 - ? secondary - ? "text.line.first.and.arrowtriangle.forward" - : "text.line.last.and.arrowtriangle.forward" - : "arrow.down" - } - size={22} - tintColor="white" - /> + {IS_ANDROID ? ( + + ) : ( + 0 + ? secondary + ? "text.line.first.and.arrowtriangle.forward" + : "text.line.last.and.arrowtriangle.forward" + : "arrow.down" + } + size={22} + tintColor="white" + /> + )} -- 2.54.1 From c8a6df454dea81f8bd2a43727d6b30ff31f80a9a Mon Sep 17 00:00:00 2001 From: Joshua Higgins Date: Sun, 15 Nov 2026 17:31:35 -0500 Subject: [PATCH 4/5] fix(mobile): handle Android swipes inside native menu hosts --- apps/mobile/components/media-menu.android.tsx | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/apps/mobile/components/media-menu.android.tsx b/apps/mobile/components/media-menu.android.tsx index 137e62c..e54a04c 100644 --- a/apps/mobile/components/media-menu.android.tsx +++ b/apps/mobile/components/media-menu.android.tsx @@ -11,7 +11,11 @@ import { } from "@expo/ui/jetpack-compose" import { useState } from "react" import { Pressable, View } from "react-native" -import { Gesture, GestureDetector } from "react-native-gesture-handler" +import { + Gesture, + GestureDetector, + GestureHandlerRootView, +} from "react-native-gesture-handler" import { appleMusic } from "@/lib/theme" @@ -75,9 +79,16 @@ export function MenuView({ matchContents={shouldOpenOnLongPress ? { vertical: true } : true} > {shouldOpenOnLongPress ? ( - - {children} - + // Compose hosts the RN subtree across a native touch boundary. + // Keep its menu and row gestures under a root inside that boundary. + + + {children} + + ) : ( setExpanded(true)} -- 2.54.1 From 33eb56b5451af698cbb9ad9b1abb294e43c826ad Mon Sep 17 00:00:00 2001 From: Joshua Higgins Date: Sun, 15 Nov 2026 17:34:42 -0500 Subject: [PATCH 5/5] Revert "fix(mobile): handle Android swipes inside native menu hosts" This reverts commit c8a6df454dea81f8bd2a43727d6b30ff31f80a9a. --- apps/mobile/components/media-menu.android.tsx | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/apps/mobile/components/media-menu.android.tsx b/apps/mobile/components/media-menu.android.tsx index e54a04c..137e62c 100644 --- a/apps/mobile/components/media-menu.android.tsx +++ b/apps/mobile/components/media-menu.android.tsx @@ -11,11 +11,7 @@ import { } from "@expo/ui/jetpack-compose" import { useState } from "react" import { Pressable, View } from "react-native" -import { - Gesture, - GestureDetector, - GestureHandlerRootView, -} from "react-native-gesture-handler" +import { Gesture, GestureDetector } from "react-native-gesture-handler" import { appleMusic } from "@/lib/theme" @@ -79,16 +75,9 @@ export function MenuView({ matchContents={shouldOpenOnLongPress ? { vertical: true } : true} > {shouldOpenOnLongPress ? ( - // Compose hosts the RN subtree across a native touch boundary. - // Keep its menu and row gestures under a root inside that boundary. - - - {children} - - + + {children} + ) : ( setExpanded(true)} -- 2.54.1