Playlist header with tracks and shuffle
import * as React from "react";
import { ScrollView, View } from "react-native";
import { SafeAreaView, useSafeAreaInsets } from "react-native-safe-area-context";
import { Button, Glass, Icon, Image, List, Text } from "@lumioui/ui";
import { useHaptic } from "@lumioui/core";
import { Mount, Press, SEPARATOR_INSET, World } from "../shared";
export interface PlaylistTrack {
id: string;
title: string;
artist: string;
duration: string;
artworkUrl?: string;
}
export interface PlaylistDetailScreenProps {
name?: string;
/** "24 songs · 1h 32m" */
stats?: string;
coverUrl?: string;
tracks?: PlaylistTrack[];
onTrackPress?: (id: string) => void;
onPlay?: () => void;
onShuffle?: () => void;
onBack?: () => void;
}
const art = (id: string) =>
`https://images.unsplash.com/photo-${id}?w=120&h=120&fit=crop&q=60&auto=format`;
const DEFAULT_TRACKS: PlaylistTrack[] = [
{ id: "t1", title: "Static Bloom", artist: "Vera Sola", duration: "3:41", artworkUrl: art("1470225620780-dba8ba36b745") },
{ id: "t2", title: "Half-Light", artist: "Overcoats", duration: "4:02", artworkUrl: art("1493225457124-a3eb161ffa5f") },
{ id: "t3", title: "Deep in Flow", artist: "Mokira", duration: "2:58", artworkUrl: art("1459749411175-04bf5292ceea") },
{ id: "t4", title: "Meridian", artist: "Hania Rani", duration: "5:12", artworkUrl: art("1471478331149-c72f17e33c73") },
{ id: "t5", title: "North Coast", artist: "Bratři Orff", duration: "3:27", artworkUrl: art("1511671782779-c97d3d27a1d4") },
{ id: "t6", title: "Aurora Drift", artist: "Goldmund", duration: "4:44", artworkUrl: art("1518609878373-06d740f60d8b") },
{ id: "t7", title: "Paper Planes", artist: "Kina", duration: "2:51", artworkUrl: art("1505740420928-5e560c06d30e") },
{ id: "t8", title: "Night Bus", artist: "Jóhann Johannsson", duration: "6:08", artworkUrl: art("1478737270239-2f02b77fc618") },
{ id: "t9", title: "Slow Arc", artist: "Rachel's", duration: "5:33", artworkUrl: art("1520523839897-bd0b52f945a0") },
{ id: "t10", title: "Transit", artist: "Bonobo", duration: "4:12", artworkUrl: art("1511379938547-c1f69419868d") },
{ id: "t11", title: "Glasshouse", artist: "Marconi Union", duration: "8:02", artworkUrl: art("1508700115892-45ecd05ae2ad") },
{ id: "t12", title: "Departure", artist: "Ólafur Arnalds", duration: "3:58", artworkUrl: art("1485579149621-3123dd979885") },
];
/** Playlist detail — cover header, play/shuffle actions, track rows. */
export function PlaylistDetailScreen({
name = "Late Night Orbit",
stats = "12 songs · 55m",
coverUrl = "https://images.unsplash.com/photo-1458560871784-56d23406c091?w=500&h=500&fit=crop&q=70&auto=format",
tracks = DEFAULT_TRACKS,
onTrackPress,
onPlay,
onShuffle,
onBack,
}: PlaylistDetailScreenProps) {
const haptics = useHaptic();
const insets = useSafeAreaInsets();
return (
<World primary="#65A30D">
<SafeAreaView className="flex-1 bg-[#F4F5F9] dark:bg-[#111114]" edges={["top"]}>
<View pointerEvents="box-none" className="absolute inset-x-4 z-10" style={{ top: insets.top + 8 }}>
<View className="flex-row items-center justify-between">
<Glass interactive effect="regular" className="h-11 w-11 items-center justify-center rounded-full">
<Press
haptic="light"
onPress={() => onBack?.()}
accessibilityRole="button"
accessibilityLabel="Go back"
className="h-9 w-9 items-center justify-center"
>
<Icon name="chevron-left" size="md" color="foreground" />
</Press>
</Glass>
<View className="h-11 w-11" />
</View>
</View>
<ScrollView
showsVerticalScrollIndicator={false}
contentContainerStyle={{ paddingTop: insets.top + 60, paddingBottom: insets.bottom + 32 }}
>
{/* Cover + stats + actions. */}
<Mount className="items-center px-8">
<Image
source={{ uri: coverUrl }}
className="aspect-square w-56 rounded-3xl bg-muted"
accessibilityLabel={`${name} cover`}
/>
<Text variant="h3" className="mt-3 text-center" numberOfLines={1}>
{name}
</Text>
<Text variant="small" className="text-muted-foreground">
{stats}
</Text>
{/* Curator line — playlists credit a human, not an algorithm. */}
<Text variant="muted" className="mt-0.5 text-xs">
Made by you · updated Tuesday
</Text>
<View className="mt-3 w-full flex-row gap-3">
<Button
haptic="light"
onPress={() => {
haptics.light();
onPlay?.();
}}
accessibilityLabel="Play playlist"
className="bg-[#1B1B26] h-11 flex-1"
>
<Icon name="play" size="sm" color="#BEF04C" />
<Text className="ml-1.5 text-sm font-medium text-[#F5F7F5]">
Play
</Text>
</Button>
<Button
variant="secondary"
haptic="light"
onPress={() => {
haptics.light();
onShuffle?.();
}}
accessibilityLabel="Shuffle playlist"
className="h-11 flex-1"
>
<Icon name="shuffle" size="sm" color="foreground" />
<Text className="ml-1.5 text-sm font-medium">Shuffle</Text>
</Button>
</View>
</Mount>
{/* Tracks. */}
<Mount delay={90} className="mt-5">
<List inset>
<List.Section>
{tracks.map((t, ii) => (
<React.Fragment key={t.id}>
{ii > 0 && <List.Separator className={SEPARATOR_INSET} />}
<List.Item
title={t.title}
subtitle={t.artist}
leading={
<Image
source={{ uri: t.artworkUrl }}
className="h-11 w-11 rounded-xl bg-muted"
accessibilityLabel={`${t.title} artwork`}
/>
}
trailing={
<Text variant="small" className="text-muted-foreground">
{t.duration}
</Text>
}
haptic="light"
onPress={() => onTrackPress?.(t.id)}
className="py-2.5"
/>
</React.Fragment>
))}
</List.Section>
</List>
</Mount>
</ScrollView>
</SafeAreaView>
</World>
);
}
PlaylistDetailScreen.displayName = "PlaylistDetailScreen";
Recreate the "Playlist Detail Screen" screen in React Native using LumioUI.
Goal: Playlist header with tracks and shuffle Match the reference implementation's layout, behavior, and motion exactly — this is a production screen, not a mockup.
## Setup
Fastest path — install the screen plus its component deps:
```bash
npx lumioui add media-playlist-detail
```
Or pull just the components: `npx lumioui add button icon image list text`
Native packages:
- @lumioui/ui@latest
- @lumioui/core@latest
- react-native-safe-area-context@*
- react-native-reanimated@*
- react-native-svg@*
- nativewind@*
Stack assumptions: Expo SDK 54 / RN 0.81, Reanimated 4, NativeWind v4, TypeScript strict, Expo Go compatible.
## Components — how, where, when
### `button` — Tactile pill button with press spring, ink wash and async loading.
- `<Button>` ×2
### `icon` — Lucide icon set mapped to theme colors and sizes.
- `<Icon>` ×3
### `image` — Cached image with placeholder, fallback and aspect handling.
- `<Image>` ×2
### `list` — Settings-style rows with separators and press feedback.
- `<List>` ×1
### `text` — Themed type scale from caption to display.
- `<Text>` ×6
## Conventions (non-negotiable)
- Styling via NativeWind `className` with semantic tokens only: `bg-background`, `text-foreground`, `bg-card`, `text-card-foreground`, `bg-secondary`, `bg-muted`, `text-muted-foreground`, `bg-accent`, `bg-destructive`, `border-border`. Hard-coded colors only inside media overlays (`text-white`, `bg-black/N`).
- Motion via the token presets from `@lumioui/core` (`spring.press`, `spring.surface`, `spring.glide`, `timing.fast`, `timing.slow`, …) — no bespoke spring configs or durations.
- Gate transform motion behind `useReducedMotion()`; keep opacity/color feedback, drop travel and overshoot.
- Haptics via `useHaptic()`: `light` on press, `selection` on toggle/select, `warning` on invalid input. Never import expo-haptics directly.
- Press feedback via `usePressAnimation()` (~0.97 scale), not `activeOpacity` tricks.
- a11y: `accessibilityRole` + `accessibilityLabel` on every control, touch targets ≥44pt.
- Entrance choreography: staggered `Mount` wrappers (delay 0/60/120…) so regions land in sequence instead of popping in at once.
- Wrap the screen in `SafeAreaView`; keep dark mode working via the semantic tokens.
## Deliverable
One file: `screens/media/playlist-detail.tsx` exporting PlaylistDetailScreen. Preserve the props interface — the host app wires the callbacks (navigation, submit handlers) through them.
## Reference implementation
The LumioUI source for this screen — reproduce it faithfully:
```tsx
import * as React from "react";
import { ScrollView, View } from "react-native";
import { SafeAreaView, useSafeAreaInsets } from "react-native-safe-area-context";
import { Button, Glass, Icon, Image, List, Text } from "@lumioui/ui";
import { useHaptic } from "@lumioui/core";
import { Mount, Press, SEPARATOR_INSET, World } from "../shared";
export interface PlaylistTrack {
id: string;
title: string;
artist: string;
duration: string;
artworkUrl?: string;
}
export interface PlaylistDetailScreenProps {
name?: string;
/** "24 songs · 1h 32m" */
stats?: string;
coverUrl?: string;
tracks?: PlaylistTrack[];
onTrackPress?: (id: string) => void;
onPlay?: () => void;
onShuffle?: () => void;
onBack?: () => void;
}
const art = (id: string) =>
`https://images.unsplash.com/photo-${id}?w=120&h=120&fit=crop&q=60&auto=format`;
const DEFAULT_TRACKS: PlaylistTrack[] = [
{ id: "t1", title: "Static Bloom", artist: "Vera Sola", duration: "3:41", artworkUrl: art("1470225620780-dba8ba36b745") },
{ id: "t2", title: "Half-Light", artist: "Overcoats", duration: "4:02", artworkUrl: art("1493225457124-a3eb161ffa5f") },
{ id: "t3", title: "Deep in Flow", artist: "Mokira", duration: "2:58", artworkUrl: art("1459749411175-04bf5292ceea") },
{ id: "t4", title: "Meridian", artist: "Hania Rani", duration: "5:12", artworkUrl: art("1471478331149-c72f17e33c73") },
{ id: "t5", title: "North Coast", artist: "Bratři Orff", duration: "3:27", artworkUrl: art("1511671782779-c97d3d27a1d4") },
{ id: "t6", title: "Aurora Drift", artist: "Goldmund", duration: "4:44", artworkUrl: art("1518609878373-06d740f60d8b") },
{ id: "t7", title: "Paper Planes", artist: "Kina", duration: "2:51", artworkUrl: art("1505740420928-5e560c06d30e") },
{ id: "t8", title: "Night Bus", artist: "Jóhann Johannsson", duration: "6:08", artworkUrl: art("1478737270239-2f02b77fc618") },
{ id: "t9", title: "Slow Arc", artist: "Rachel's", duration: "5:33", artworkUrl: art("1520523839897-bd0b52f945a0") },
{ id: "t10", title: "Transit", artist: "Bonobo", duration: "4:12", artworkUrl: art("1511379938547-c1f69419868d") },
{ id: "t11", title: "Glasshouse", artist: "Marconi Union", duration: "8:02", artworkUrl: art("1508700115892-45ecd05ae2ad") },
{ id: "t12", title: "Departure", artist: "Ólafur Arnalds", duration: "3:58", artworkUrl: art("1485579149621-3123dd979885") },
];
/** Playlist detail — cover header, play/shuffle actions, track rows. */
export function PlaylistDetailScreen({
name = "Late Night Orbit",
stats = "12 songs · 55m",
coverUrl = "https://images.unsplash.com/photo-1458560871784-56d23406c091?w=500&h=500&fit=crop&q=70&auto=format",
tracks = DEFAULT_TRACKS,
onTrackPress,
onPlay,
onShuffle,
onBack,
}: PlaylistDetailScreenProps) {
const haptics = useHaptic();
const insets = useSafeAreaInsets();
return (
<World primary="#65A30D">
<SafeAreaView className="flex-1 bg-[#F4F5F9] dark:bg-[#111114]" edges={["top"]}>
<View pointerEvents="box-none" className="absolute inset-x-4 z-10" style={{ top: insets.top + 8 }}>
<View className="flex-row items-center justify-between">
<Glass interactive effect="regular" className="h-11 w-11 items-center justify-center rounded-full">
<Press
haptic="light"
onPress={() => onBack?.()}
accessibilityRole="button"
accessibilityLabel="Go back"
className="h-9 w-9 items-center justify-center"
>
<Icon name="chevron-left" size="md" color="foreground" />
</Press>
</Glass>
<View className="h-11 w-11" />
</View>
</View>
<ScrollView
showsVerticalScrollIndicator={false}
contentContainerStyle={{ paddingTop: insets.top + 60, paddingBottom: insets.bottom + 32 }}
>
{/* Cover + stats + actions. */}
<Mount className="items-center px-8">
<Image
source={{ uri: coverUrl }}
className="aspect-square w-56 rounded-3xl bg-muted"
accessibilityLabel={`${name} cover`}
/>
<Text variant="h3" className="mt-3 text-center" numberOfLines={1}>
{name}
</Text>
<Text variant="small" className="text-muted-foreground">
{stats}
</Text>
{/* Curator line — playlists credit a human, not an algorithm. */}
<Text variant="muted" className="mt-0.5 text-xs">
Made by you · updated Tuesday
</Text>
<View className="mt-3 w-full flex-row gap-3">
<Button
haptic="light"
onPress={() => {
haptics.light();
onPlay?.();
}}
accessibilityLabel="Play playlist"
className="bg-[#1B1B26] h-11 flex-1"
>
<Icon name="play" size="sm" color="#BEF04C" />
<Text className="ml-1.5 text-sm font-medium text-[#F5F7F5]">
Play
</Text>
</Button>
<Button
variant="secondary"
haptic="light"
onPress={() => {
haptics.light();
onShuffle?.();
}}
accessibilityLabel="Shuffle playlist"
className="h-11 flex-1"
>
<Icon name="shuffle" size="sm" color="foreground" />
<Text className="ml-1.5 text-sm font-medium">Shuffle</Text>
</Button>
</View>
</Mount>
{/* Tracks. */}
<Mount delay={90} className="mt-5">
<List inset>
<List.Section>
{tracks.map((t, ii) => (
<React.Fragment key={t.id}>
{ii > 0 && <List.Separator className={SEPARATOR_INSET} />}
<List.Item
title={t.title}
subtitle={t.artist}
leading={
<Image
source={{ uri: t.artworkUrl }}
className="h-11 w-11 rounded-xl bg-muted"
accessibilityLabel={`${t.title} artwork`}
/>
}
trailing={
<Text variant="small" className="text-muted-foreground">
{t.duration}
</Text>
}
haptic="light"
onPress={() => onTrackPress?.(t.id)}
className="py-2.5"
/>
</React.Fragment>
))}
</List.Section>
</List>
</Mount>
</ScrollView>
</SafeAreaView>
</World>
);
}
PlaylistDetailScreen.displayName = "PlaylistDetailScreen";
```
Screen: https://lumioui.dev/screens/media-playlist-detail