Downloaded files with progress indicator and delete action.
import * as React from "react";
import { ScrollView, View } from "react-native";
import { SafeAreaView, useSafeAreaInsets } from "react-native-safe-area-context";
import { Button, EmptyState, Glass, Icon, Progress, Text, type IconName, } from "@lumioui/ui";
import { useHaptic } from "@lumioui/core";
import { Mount, Press, RowIcon, type IconTone } from "../shared";
export interface DownloadItem {
id: string;
title: string;
/** e.g. "PDF · 2.4 MB" */
meta: string;
icon: IconName;
tone: IconTone;
/** 0–100 while downloading; undefined when complete. */
progress?: number;
}
export interface DownloadsScreenProps {
items?: DownloadItem[];
onItemPress?: (id: string) => void;
onRemove?: (id: string) => void;
onBack?: () => void;
}
const SEGMENTS = [
{ label: "Photos", size: "412 MB", pct: 62, hex: "#4A7FD4" },
{ label: "Audio", size: "38 MB", pct: 16, hex: "#E8862D" },
{ label: "Docs", size: "7 MB", pct: 12, hex: "#1E9E63" },
{ label: "Archives", size: "19 MB", pct: 10, hex: "#7C5CFC" },
];
const DEFAULT_ITEMS: DownloadItem[] = [
{ id: "d1", title: "Boarding pass — SFO → JFK", meta: "PDF · 84 KB · Ready", icon: "file-text", tone: "blue" },
{ id: "d2", title: "Q3 invoice bundle.zip", meta: "Archive · 18.2 MB · Ready", icon: "package", tone: "purple" },
{ id: "d3", title: "Brand guidelines 2026", meta: "PDF · 7.1 MB · 62%", icon: "file-text", tone: "teal", progress: 62 },
{ id: "d4", title: "Team offsite photos", meta: "128 photos · 412 MB · Ready", icon: "image", tone: "green" },
{ id: "d5", title: "Podcast ep. 47 — Spring-loaded UI", meta: "Audio · 38 MB · Ready", icon: "mic", tone: "orange" },
{ id: "d6", title: "Onboarding deck v3", meta: "Keynote · 21 MB · Ready", icon: "grid", tone: "blue" },
];
/** Downloads — file list with in-progress indicator and offline note. */
export function DownloadsScreen({
items = DEFAULT_ITEMS,
onItemPress,
onRemove,
onBack,
}: DownloadsScreenProps) {
const haptics = useHaptic();
const insets = useSafeAreaInsets();
return (
<SafeAreaView className="flex-1 bg-[#F4F5F9] dark:bg-[#111114]" edges={["top"]}>
{/* Floating chrome — back pill + hug-label title pill + Select pill. */}
<View className="absolute inset-x-4 z-10" style={{ top: insets.top + 8 }} pointerEvents="box-none">
<View className="flex-row items-center justify-between gap-2">
<Glass
effect="regular"
className="h-11 w-11 items-center justify-center rounded-full"
>
<Button
variant="ghost"
size="icon"
haptic="light"
onPress={() => onBack?.()}
accessibilityLabel="Go back"
className="h-9 w-9"
>
<Icon name="chevron-left" size="md" color="foreground" />
</Button>
</Glass>
<Glass
effect="regular"
className="h-11 flex-row items-center justify-center rounded-full px-4"
>
<Button
variant="ghost"
size="sm"
haptic="light"
onPress={() => haptics.light()}
accessibilityLabel="Select downloads"
>
Select
</Button>
</Glass>
</View>
<View pointerEvents="none" className="absolute inset-0 items-center justify-center">
<Glass
effect="regular"
className="h-11 flex-row items-center justify-center rounded-full px-5"
>
<Text accessibilityRole="header" className="text-sm font-bold tracking-tight">
Downloads
</Text>
</Glass>
</View>
</View>
{items.length === 0 ? (
<Mount className="flex-1 items-center justify-center px-8">
<EmptyState
icon={<Icon name="download" size="lg" color="mutedForeground" />}
title="No downloads yet"
description="Files you save for offline use appear here."
/>
</Mount>
) : (
<ScrollView
showsVerticalScrollIndicator={false}
contentContainerStyle={{ paddingTop: insets.top + 60, paddingBottom: insets.bottom + 32 }}
>
{/* Storage meter — iPhone-storage idiom: one segmented bar
divided by file type with a dot legend, not a lone track. */}
<View className="mx-6 mb-4 rounded-2xl bg-white p-4 dark:bg-[#1A1A20]">
<View className="flex-row items-center justify-between pb-2.5">
<Text className="text-sm font-semibold">On this device</Text>
<Text variant="small" className="text-muted-foreground tabular-nums">
476 MB of 5 GB
</Text>
</View>
<View
className="h-2.5 flex-row gap-[3px] overflow-hidden rounded-full"
accessibilityLabel="Downloads use 476 MB of 5 GB offline storage"
>
{SEGMENTS.map((s) => (
<View key={s.label} className="h-full rounded-full" style={{ width: `${s.pct}%`, backgroundColor: s.hex }} />
))}
</View>
<View className="flex-row flex-wrap gap-x-4 gap-y-1 pt-3">
{SEGMENTS.map((s) => (
<View key={s.label} className="flex-row items-center gap-1.5">
<View className="h-2 w-2 rounded-full" style={{ backgroundColor: s.hex }} />
<Text variant="small" className="text-muted-foreground">{s.label} · {s.size}</Text>
</View>
))}
</View>
<Text variant="muted" className="pt-2.5 text-xs">
Offline files auto-remove after 30 days
</Text>
{/* Wi-Fi-only is the control people actually look for here. */}
<View className="mt-3 flex-row items-center gap-2.5 rounded-xl bg-[#F4F5F9] px-3.5 py-2.5 dark:bg-white/10">
<Icon name="wifi" size="sm" color="mutedForeground" />
<Text variant="small" className="flex-1 text-xs">
Download on Wi-Fi only
</Text>
<View className="h-4.5 w-4.5 items-center justify-center rounded-full bg-[#BEF04C]">
<Icon name="check" size="sm" color="#1B1B26" />
</View>
</View>
</View>
{/* File cards — each download is its own card with a tonal
icon tile; in-flight items get the progress track inside
the card body rather than a list separator rhythm. */}
<View className="gap-3 px-6 pt-2">
{items.map((item) => (
<Press
key={item.id}
haptic="light"
pressedScale={0.98}
onPress={() => onItemPress?.(item.id)}
accessibilityRole="button"
accessibilityLabel={item.title}
className="rounded-2xl bg-white p-4 dark:bg-[#1A1A20]"
>
<View className="flex-row items-center gap-3">
<RowIcon name={item.icon} tone={item.tone} />
<View className="flex-1">
<Text className="text-sm font-semibold" numberOfLines={1}>
{item.title}
</Text>
<Text variant="small" className="text-muted-foreground">
{item.meta}
</Text>
</View>
{item.progress === undefined ? (
<Button
variant="ghost"
size="icon"
haptic="medium"
onPress={() => {
haptics.warning();
onRemove?.(item.id);
}}
accessibilityLabel={`Delete ${item.title}`}
className="h-9 w-9"
>
<Icon name="trash" size="sm" color="mutedForeground" />
</Button>
) : (
<Text variant="small" className="font-medium text-foreground tabular-nums">
{item.progress}%
</Text>
)}
</View>
{item.progress !== undefined && (
<Progress
value={item.progress}
className="mt-3 h-1.5"
indicatorClassName="bg-[#3E9AA3]"
accessibilityLabel={`Downloading ${item.title}, ${item.progress}%`}
/>
)}
</Press>
))}
</View>
<View className="flex-row items-center justify-between px-6 pt-5">
<Text className="text-sm font-semibold">Smart downloads</Text>
<Text variant="small" className="font-medium text-foreground">
Manage
</Text>
</View>
<Text variant="small" className="px-6 pt-1 text-muted-foreground">
Keep podcasts and docs for trips — refreshed over Wi-Fi.
</Text>
</ScrollView>
)}
</SafeAreaView>
);
}
DownloadsScreen.displayName = "DownloadsScreen";
Recreate the "Downloads Screen" screen in React Native using LumioUI.
Goal: Downloaded files with progress indicator and delete action. 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 core-downloads
```
Or pull just the components: `npx lumioui add button empty-state icon list progress 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>` ×3
### `empty-state` — Illustrated placeholder with title, copy and action slot.
- `<EmptyState>` ×1
### `icon` — Lucide icon set mapped to theme colors and sizes.
- `<Icon>` ×5
### `list` — Settings-style rows with separators and press feedback.
- imported but not rendered directly — likely used through a sibling or as a utility
### `progress` — Animated fill bar with indeterminate sweep mode.
- `<Progress>` ×1
### `text` — Themed type scale from caption to display.
- `<Text>` ×12
## 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/core/downloads.tsx` exporting DownloadsScreen. 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, EmptyState, Glass, Icon, Progress, Text, type IconName, } from "@lumioui/ui";
import { useHaptic } from "@lumioui/core";
import { Mount, Press, RowIcon, type IconTone } from "../shared";
export interface DownloadItem {
id: string;
title: string;
/** e.g. "PDF · 2.4 MB" */
meta: string;
icon: IconName;
tone: IconTone;
/** 0–100 while downloading; undefined when complete. */
progress?: number;
}
export interface DownloadsScreenProps {
items?: DownloadItem[];
onItemPress?: (id: string) => void;
onRemove?: (id: string) => void;
onBack?: () => void;
}
const SEGMENTS = [
{ label: "Photos", size: "412 MB", pct: 62, hex: "#4A7FD4" },
{ label: "Audio", size: "38 MB", pct: 16, hex: "#E8862D" },
{ label: "Docs", size: "7 MB", pct: 12, hex: "#1E9E63" },
{ label: "Archives", size: "19 MB", pct: 10, hex: "#7C5CFC" },
];
const DEFAULT_ITEMS: DownloadItem[] = [
{ id: "d1", title: "Boarding pass — SFO → JFK", meta: "PDF · 84 KB · Ready", icon: "file-text", tone: "blue" },
{ id: "d2", title: "Q3 invoice bundle.zip", meta: "Archive · 18.2 MB · Ready", icon: "package", tone: "purple" },
{ id: "d3", title: "Brand guidelines 2026", meta: "PDF · 7.1 MB · 62%", icon: "file-text", tone: "teal", progress: 62 },
{ id: "d4", title: "Team offsite photos", meta: "128 photos · 412 MB · Ready", icon: "image", tone: "green" },
{ id: "d5", title: "Podcast ep. 47 — Spring-loaded UI", meta: "Audio · 38 MB · Ready", icon: "mic", tone: "orange" },
{ id: "d6", title: "Onboarding deck v3", meta: "Keynote · 21 MB · Ready", icon: "grid", tone: "blue" },
];
/** Downloads — file list with in-progress indicator and offline note. */
export function DownloadsScreen({
items = DEFAULT_ITEMS,
onItemPress,
onRemove,
onBack,
}: DownloadsScreenProps) {
const haptics = useHaptic();
const insets = useSafeAreaInsets();
return (
<SafeAreaView className="flex-1 bg-[#F4F5F9] dark:bg-[#111114]" edges={["top"]}>
{/* Floating chrome — back pill + hug-label title pill + Select pill. */}
<View className="absolute inset-x-4 z-10" style={{ top: insets.top + 8 }} pointerEvents="box-none">
<View className="flex-row items-center justify-between gap-2">
<Glass
effect="regular"
className="h-11 w-11 items-center justify-center rounded-full"
>
<Button
variant="ghost"
size="icon"
haptic="light"
onPress={() => onBack?.()}
accessibilityLabel="Go back"
className="h-9 w-9"
>
<Icon name="chevron-left" size="md" color="foreground" />
</Button>
</Glass>
<Glass
effect="regular"
className="h-11 flex-row items-center justify-center rounded-full px-4"
>
<Button
variant="ghost"
size="sm"
haptic="light"
onPress={() => haptics.light()}
accessibilityLabel="Select downloads"
>
Select
</Button>
</Glass>
</View>
<View pointerEvents="none" className="absolute inset-0 items-center justify-center">
<Glass
effect="regular"
className="h-11 flex-row items-center justify-center rounded-full px-5"
>
<Text accessibilityRole="header" className="text-sm font-bold tracking-tight">
Downloads
</Text>
</Glass>
</View>
</View>
{items.length === 0 ? (
<Mount className="flex-1 items-center justify-center px-8">
<EmptyState
icon={<Icon name="download" size="lg" color="mutedForeground" />}
title="No downloads yet"
description="Files you save for offline use appear here."
/>
</Mount>
) : (
<ScrollView
showsVerticalScrollIndicator={false}
contentContainerStyle={{ paddingTop: insets.top + 60, paddingBottom: insets.bottom + 32 }}
>
{/* Storage meter — iPhone-storage idiom: one segmented bar
divided by file type with a dot legend, not a lone track. */}
<View className="mx-6 mb-4 rounded-2xl bg-white p-4 dark:bg-[#1A1A20]">
<View className="flex-row items-center justify-between pb-2.5">
<Text className="text-sm font-semibold">On this device</Text>
<Text variant="small" className="text-muted-foreground tabular-nums">
476 MB of 5 GB
</Text>
</View>
<View
className="h-2.5 flex-row gap-[3px] overflow-hidden rounded-full"
accessibilityLabel="Downloads use 476 MB of 5 GB offline storage"
>
{SEGMENTS.map((s) => (
<View key={s.label} className="h-full rounded-full" style={{ width: `${s.pct}%`, backgroundColor: s.hex }} />
))}
</View>
<View className="flex-row flex-wrap gap-x-4 gap-y-1 pt-3">
{SEGMENTS.map((s) => (
<View key={s.label} className="flex-row items-center gap-1.5">
<View className="h-2 w-2 rounded-full" style={{ backgroundColor: s.hex }} />
<Text variant="small" className="text-muted-foreground">{s.label} · {s.size}</Text>
</View>
))}
</View>
<Text variant="muted" className="pt-2.5 text-xs">
Offline files auto-remove after 30 days
</Text>
{/* Wi-Fi-only is the control people actually look for here. */}
<View className="mt-3 flex-row items-center gap-2.5 rounded-xl bg-[#F4F5F9] px-3.5 py-2.5 dark:bg-white/10">
<Icon name="wifi" size="sm" color="mutedForeground" />
<Text variant="small" className="flex-1 text-xs">
Download on Wi-Fi only
</Text>
<View className="h-4.5 w-4.5 items-center justify-center rounded-full bg-[#BEF04C]">
<Icon name="check" size="sm" color="#1B1B26" />
</View>
</View>
</View>
{/* File cards — each download is its own card with a tonal
icon tile; in-flight items get the progress track inside
the card body rather than a list separator rhythm. */}
<View className="gap-3 px-6 pt-2">
{items.map((item) => (
<Press
key={item.id}
haptic="light"
pressedScale={0.98}
onPress={() => onItemPress?.(item.id)}
accessibilityRole="button"
accessibilityLabel={item.title}
className="rounded-2xl bg-white p-4 dark:bg-[#1A1A20]"
>
<View className="flex-row items-center gap-3">
<RowIcon name={item.icon} tone={item.tone} />
<View className="flex-1">
<Text className="text-sm font-semibold" numberOfLines={1}>
{item.title}
</Text>
<Text variant="small" className="text-muted-foreground">
{item.meta}
</Text>
</View>
{item.progress === undefined ? (
<Button
variant="ghost"
size="icon"
haptic="medium"
onPress={() => {
haptics.warning();
onRemove?.(item.id);
}}
accessibilityLabel={`Delete ${item.title}`}
className="h-9 w-9"
>
<Icon name="trash" size="sm" color="mutedForeground" />
</Button>
) : (
<Text variant="small" className="font-medium text-foreground tabular-nums">
{item.progress}%
</Text>
)}
</View>
{item.progress !== undefined && (
<Progress
value={item.progress}
className="mt-3 h-1.5"
indicatorClassName="bg-[#3E9AA3]"
accessibilityLabel={`Downloading ${item.title}, ${item.progress}%`}
/>
)}
</Press>
))}
</View>
<View className="flex-row items-center justify-between px-6 pt-5">
<Text className="text-sm font-semibold">Smart downloads</Text>
<Text variant="small" className="font-medium text-foreground">
Manage
</Text>
</View>
<Text variant="small" className="px-6 pt-1 text-muted-foreground">
Keep podcasts and docs for trips — refreshed over Wi-Fi.
</Text>
</ScrollView>
)}
</SafeAreaView>
);
}
DownloadsScreen.displayName = "DownloadsScreen";
```
Screen: https://lumioui.dev/screens/core-downloads