Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion packages/mobile/src/components/lineup-tile/CollectionTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,14 @@ export const CollectionTile = (props: CollectionTileProps) => {
return tracks.find((track) => track.track_id === trackId) ?? null
})

// Title tints to the active/playing color whenever any track in this
// collection is the one currently playing. Mirrors TrackTile's per-tile
// highlight (LineupTileMetadata: `color={isActive ? 'primary' : 'neutral'}`)
// and the per-row highlight in CollectionTileTrackList (each TrackItem
// already runs its own `getTrackId(state) === trackId` selector and
// applies `styles.active` / `palette.primary` to its title text).
const isActive = currentTrack != null

const isCollectionMarkedForDownload = useSelector((state) =>
collection
? getIsCollectionMarkedForDownload(collection.playlist_id.toString())(
Expand Down Expand Up @@ -300,7 +308,11 @@ export const CollectionTile = (props: CollectionTileProps) => {
onPressIn={handlePressWithPropagationBlock}
onPress={handlePressTitle}
>
<Text variant='title' numberOfLines={1}>
<Text
variant='title'
color={isActive ? 'active' : 'default'}
numberOfLines={1}
>
{collection.playlist_name}
</Text>
</TouchableOpacity>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,25 @@ const TrackItem = (props: TrackItemProps) => {
<Text style={[styles.text, isPlayingUid && styles.active]}>
{index + 1}
</Text>
{/*
Active color must be the LAST entry in the style array.
React Native's style array merge is left-to-right with later
entries winning per-property — but when a conditional active
style sits at index 2 and a falsy `deleted && styles.deleted`
sits at index 3, the result on this version of RN drops the
active override and `styles.title.color` (palette.neutral)
wins. The index Text doesn't hit this because its array is
only 2 entries ([text, active]). Putting `active` last
makes the merge unambiguous: when playing, primary wins;
when not playing, the conditional falsy entry is skipped
and styles.title/styles.deleted resolve normally.
*/}
<Text
style={[
styles.text,
styles.title,
isPlayingUid && styles.active,
deleted && styles.deleted
deleted && styles.deleted,
isPlayingUid && styles.active
]}
numberOfLines={1}
>
Expand All @@ -127,8 +140,8 @@ const TrackItem = (props: TrackItemProps) => {
style={[
styles.text,
styles.artist,
isPlayingUid && styles.active,
deleted && styles.deleted
deleted && styles.deleted,
isPlayingUid && styles.active
]}
numberOfLines={1}
>
Expand Down
Loading