Skip to content

Commit

Permalink
[C-5371] Improve tile press responsiveness (#10394)
Browse files Browse the repository at this point in the history
  • Loading branch information
amendelsohn authored Nov 8, 2024
1 parent c6e5fd4 commit 01e998e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
12 changes: 7 additions & 5 deletions packages/mobile/src/components/lineup-tile/CollectionTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,13 @@ const CollectionTileComponent = ({
const handlePress = useCallback(() => {
if (!tracks.length) return

togglePlay({
uid: currentTrack?.uid ?? tracks[0]?.uid ?? null,
id: currentTrack?.track_id ?? tracks[0]?.track_id ?? null,
source: PlaybackSource.PLAYLIST_TILE_TRACK
})
setTimeout(() => {
togglePlay({
uid: currentTrack?.uid ?? tracks[0]?.uid ?? null,
id: currentTrack?.track_id ?? tracks[0]?.track_id ?? null,
source: PlaybackSource.PLAYLIST_TILE_TRACK
})
}, 100)
}, [currentTrack, togglePlay, tracks])

const handlePressTitle = useCallback(() => {
Expand Down
14 changes: 8 additions & 6 deletions packages/mobile/src/components/lineup-tile/TrackTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,14 @@ export const TrackTileComponent = ({
)

const handlePress = useCallback(() => {
togglePlay({
uid: lineupTileProps.uid,
id: track_id,
source: PlaybackSource.TRACK_TILE
})
onPress?.(track_id)
setTimeout(() => {
togglePlay({
uid: lineupTileProps.uid,
id: track_id,
source: PlaybackSource.TRACK_TILE
})
onPress?.(track_id)
}, 100)
}, [togglePlay, lineupTileProps.uid, track_id, onPress])

const handlePressTitle = useCallback(() => {
Expand Down

0 comments on commit 01e998e

Please sign in to comment.