Saved-items list — thumbnails with filled-heart unsave, brand and variant lines, stock badges, per-row 'Move to bag' (restock alerts when sold out), and an empty state
import * as React from "react";
import { useState } from "react";
import { View, FlatList, Pressable } from "react-native";
import { SafeAreaView, useSafeAreaInsets } from "react-native-safe-area-context";
import { Badge, Button, EmptyState, Glass, Icon, Image, Text } from "@lumioui/ui";
import { useHaptic } from "@lumioui/core";
import { catalogImg, LumioMark, Mount, Press, ROW_STAGGER, ROW_STAGGER_CAP, World } from "../shared";
export interface WishlistItem {
id: string;
name: string;
brand?: string;
variantLabel?: string;
price: number;
imageUrl?: string;
/** Sold-out items swap "Move to bag" for a notify action. */
soldOut?: boolean;
/** Optional stock badge — "Only 2 left". */
badge?: string;
}
export interface WishlistScreenProps {
items?: WishlistItem[];
currency?: string;
onToggle?: (item: WishlistItem, saved: boolean) => void;
onMoveToBag?: (item: WishlistItem) => void;
onNotify?: (item: WishlistItem) => void;
onItemPress?: (item: WishlistItem) => void;
/** Empty-state action — sends the user back to the store. */
onBrowse?: () => void;
onBack?: () => void;
}
const img = (p: Parameters<typeof catalogImg>[0]) => catalogImg(p, 200, 250);
const DEFAULT_ITEMS: WishlistItem[] = [
{ id: "2", name: "Cream Knit Poncho", brand: "Atelier M", variantLabel: "One size", price: 168, imageUrl: img("poncho") },
{ id: "4", name: "Sherpa-Lined Denim Jacket", brand: "Nord Standard", variantLabel: "Indigo · M", price: 210, imageUrl: img("denimJacket"), badge: "Only 2 left" },
{ id: "5", name: "Court Leather Sneakers", brand: "Fieldline", variantLabel: "Tan · 42", price: 145, imageUrl: img("sneakers") },
{ id: "6", name: "Quilted Liner Jacket", brand: "Atelier M", variantLabel: "Sage · S", price: 189, imageUrl: img("puffer"), soldOut: true },
];
/** Prices always render with two decimals ($168.00). */
const fmt = (n: number, currency = "$") =>
`${currency}${n.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`;
function WishlistRow({
item,
currency,
onUnsave,
onMoveToBag,
onNotify,
onPress,
}: {
item: WishlistItem;
currency: string;
onUnsave: (item: WishlistItem) => void;
onMoveToBag: (item: WishlistItem) => void;
onNotify: (item: WishlistItem) => void;
onPress?: (item: WishlistItem) => void;
}) {
const haptics = useHaptic();
return (
<View className="flex-row gap-4 rounded-3xl bg-white p-4 dark:bg-[#1A1A20]">
<Pressable
onPress={() => {
haptics.light();
onPress?.(item);
}}
accessibilityRole="button"
accessibilityLabel={`View ${item.name}`}
disabled={!onPress}
>
<Image
source={item.imageUrl ? { uri: item.imageUrl } : undefined}
rounded="xl"
aspectRatio={4 / 5}
className="w-20"
accessibilityLabel={`Photo of ${item.name}`}
/>
</Pressable>
<View className="flex-1">
<View className="flex-row items-start justify-between">
<View className="flex-1 gap-0.5 pr-2">
<Text variant="small" numberOfLines={1}>
{item.name}
</Text>
{item.brand ? (
<Text variant="muted" className="text-xs">
{item.brand}
{item.variantLabel ? ` · ${item.variantLabel}` : ""}
</Text>
) : item.variantLabel ? (
<Text variant="muted" className="text-xs">
{item.variantLabel}
</Text>
) : null}
{item.badge ? (
<Badge variant="warning" size="sm" className="mt-1">
{item.badge}
</Badge>
) : null}
{/* Price-drop callout — the reason people keep wishlists. */}
{!item.soldOut && !item.badge && item.price < 150 ? (
<View className="mt-1 flex-row items-center gap-1">
<Icon name="zap" size="sm" color="success" />
<Text variant="small" className="font-medium text-success">
Price dropped 12%
</Text>
</View>
) : null}
</View>
{/* Filled heart is the saved state — tapping unsaves the row. */}
<Pressable
onPress={() => {
haptics.selection();
onUnsave(item);
}}
accessibilityRole="button"
accessibilityLabel={`Remove ${item.name} from saved items`}
accessibilityState={{ selected: true }}
hitSlop={12}
className="h-11 w-11 items-center justify-center"
>
<Icon name="heart" size="md" color="destructive" filled />
</Pressable>
</View>
<View className="flex-row items-center justify-between pt-2">
<Text variant="small" className="font-semibold tabular-nums">
{fmt(item.price, currency)}
</Text>
{item.soldOut ? (
<Button
variant="tinted"
size="sm"
haptic="light"
icon={<Icon name="bell" size="sm" color="#65A30D" />}
onPress={() => onNotify(item)}
accessibilityLabel={`Notify me when ${item.name} is back in stock`}
>
Notify me
</Button>
) : (
<Button
tone="inverse"
size="sm"
className="bg-[#1B1B26]"
haptic="medium"
icon={<Icon name="shopping-cart" size="sm" color="#FFFFFF" />}
onPress={() => onMoveToBag(item)}
accessibilityLabel={`Move ${item.name} to bag`}
>
Move to bag
</Button>
)}
</View>
</View>
</View>
);
}
WishlistRow.displayName = "WishlistRow";
/** Wishlist — saved items with filled-heart unsave, price, and a per-row
* "Move to bag" action (sold-out rows offer restock alerts instead). */
export function WishlistScreen({
items = DEFAULT_ITEMS,
currency = "$",
onToggle,
onMoveToBag,
onNotify,
onItemPress,
onBrowse,
onBack,
}: WishlistScreenProps) {
const haptics = useHaptic();
// Local mirror of removals so unsave/move feel alive without a wired host.
const [removedIds, setRemovedIds] = useState<Set<string>>(new Set());
const visible = items.filter((i) => !removedIds.has(i.id));
const unsave = (item: WishlistItem) => {
setRemovedIds((prev) => new Set(prev).add(item.id));
onToggle?.(item, false);
};
const moveToBag = (item: WishlistItem) => {
haptics.success();
setRemovedIds((prev) => new Set(prev).add(item.id));
onMoveToBag?.(item);
};
const insets = useSafeAreaInsets();
return (
<World primary="#65A30D">
<SafeAreaView className="flex-1 bg-[#F4F5F9] dark:bg-[#111114]" edges={["top"]}>
{/* Floating chrome — back disc + centered title pill. */}
<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 pointerEvents="none" className="absolute inset-0 items-center justify-center">
<View className="h-11 flex-row items-center justify-center gap-2 rounded-full pl-3.5 pr-5">
<Glass effect="regular" className="absolute inset-0 rounded-full" />
<LumioMark size={18} />
<Text accessibilityRole="header" className="text-sm font-bold tracking-tight">
Saved{visible.length > 0 ? ` (${visible.length})` : ""}
</Text>
</View>
</View>
</View>
<FlatList
data={visible}
keyExtractor={(item) => item.id}
className="flex-1"
contentContainerClassName="px-6 pb-6"
contentContainerStyle={{ paddingTop: insets.top + 60 }}
showsVerticalScrollIndicator={false}
ListEmptyComponent={
<EmptyState
title="Nothing saved yet"
description="Tap the heart on any product and it will wait for you here."
action={
onBrowse ? (
<Button variant="secondary" onPress={onBrowse}>
Continue shopping
</Button>
) : undefined
}
className="py-24"
/>
}
ItemSeparatorComponent={() => <View className="h-4" />}
renderItem={({ item, index }) => (
<Mount delay={Math.min(index * ROW_STAGGER, ROW_STAGGER_CAP)}>
<WishlistRow
item={item}
currency={currency}
onUnsave={unsave}
onMoveToBag={moveToBag}
onNotify={(i) => onNotify?.(i)}
onPress={onItemPress}
/>
</Mount>
)}
/>
</SafeAreaView>
</World>
);
}
WishlistScreen.displayName = "WishlistScreen";
Recreate the "Wishlist Screen" screen in React Native using LumioUI.
Goal: Saved-items list — thumbnails with filled-heart unsave, brand and variant lines, stock badges, per-row 'Move to bag' (restock alerts when sold out), and an empty state 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 ecommerce-wishlist
```
Or pull just the components: `npx lumioui add badge button empty-state icon image separator 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
### `badge` — Compact status pill with variants, icons and pulse option.
- `<Badge>` ×1
### `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
### `image` — Cached image with placeholder, fallback and aspect handling.
- `<Image>` ×1
### `separator` — Hairline rule with orientation and spacing control.
- imported but not rendered directly — likely used through a sibling or as a utility
### `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/ecommerce/wishlist.tsx` exporting WishlistScreen. 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 { useState } from "react";
import { View, FlatList, Pressable } from "react-native";
import { SafeAreaView, useSafeAreaInsets } from "react-native-safe-area-context";
import { Badge, Button, EmptyState, Glass, Icon, Image, Text } from "@lumioui/ui";
import { useHaptic } from "@lumioui/core";
import { catalogImg, LumioMark, Mount, Press, ROW_STAGGER, ROW_STAGGER_CAP, World } from "../shared";
export interface WishlistItem {
id: string;
name: string;
brand?: string;
variantLabel?: string;
price: number;
imageUrl?: string;
/** Sold-out items swap "Move to bag" for a notify action. */
soldOut?: boolean;
/** Optional stock badge — "Only 2 left". */
badge?: string;
}
export interface WishlistScreenProps {
items?: WishlistItem[];
currency?: string;
onToggle?: (item: WishlistItem, saved: boolean) => void;
onMoveToBag?: (item: WishlistItem) => void;
onNotify?: (item: WishlistItem) => void;
onItemPress?: (item: WishlistItem) => void;
/** Empty-state action — sends the user back to the store. */
onBrowse?: () => void;
onBack?: () => void;
}
const img = (p: Parameters<typeof catalogImg>[0]) => catalogImg(p, 200, 250);
const DEFAULT_ITEMS: WishlistItem[] = [
{ id: "2", name: "Cream Knit Poncho", brand: "Atelier M", variantLabel: "One size", price: 168, imageUrl: img("poncho") },
{ id: "4", name: "Sherpa-Lined Denim Jacket", brand: "Nord Standard", variantLabel: "Indigo · M", price: 210, imageUrl: img("denimJacket"), badge: "Only 2 left" },
{ id: "5", name: "Court Leather Sneakers", brand: "Fieldline", variantLabel: "Tan · 42", price: 145, imageUrl: img("sneakers") },
{ id: "6", name: "Quilted Liner Jacket", brand: "Atelier M", variantLabel: "Sage · S", price: 189, imageUrl: img("puffer"), soldOut: true },
];
/** Prices always render with two decimals ($168.00). */
const fmt = (n: number, currency = "$") =>
`${currency}${n.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`;
function WishlistRow({
item,
currency,
onUnsave,
onMoveToBag,
onNotify,
onPress,
}: {
item: WishlistItem;
currency: string;
onUnsave: (item: WishlistItem) => void;
onMoveToBag: (item: WishlistItem) => void;
onNotify: (item: WishlistItem) => void;
onPress?: (item: WishlistItem) => void;
}) {
const haptics = useHaptic();
return (
<View className="flex-row gap-4 rounded-3xl bg-white p-4 dark:bg-[#1A1A20]">
<Pressable
onPress={() => {
haptics.light();
onPress?.(item);
}}
accessibilityRole="button"
accessibilityLabel={`View ${item.name}`}
disabled={!onPress}
>
<Image
source={item.imageUrl ? { uri: item.imageUrl } : undefined}
rounded="xl"
aspectRatio={4 / 5}
className="w-20"
accessibilityLabel={`Photo of ${item.name}`}
/>
</Pressable>
<View className="flex-1">
<View className="flex-row items-start justify-between">
<View className="flex-1 gap-0.5 pr-2">
<Text variant="small" numberOfLines={1}>
{item.name}
</Text>
{item.brand ? (
<Text variant="muted" className="text-xs">
{item.brand}
{item.variantLabel ? ` · ${item.variantLabel}` : ""}
</Text>
) : item.variantLabel ? (
<Text variant="muted" className="text-xs">
{item.variantLabel}
</Text>
) : null}
{item.badge ? (
<Badge variant="warning" size="sm" className="mt-1">
{item.badge}
</Badge>
) : null}
{/* Price-drop callout — the reason people keep wishlists. */}
{!item.soldOut && !item.badge && item.price < 150 ? (
<View className="mt-1 flex-row items-center gap-1">
<Icon name="zap" size="sm" color="success" />
<Text variant="small" className="font-medium text-success">
Price dropped 12%
</Text>
</View>
) : null}
</View>
{/* Filled heart is the saved state — tapping unsaves the row. */}
<Pressable
onPress={() => {
haptics.selection();
onUnsave(item);
}}
accessibilityRole="button"
accessibilityLabel={`Remove ${item.name} from saved items`}
accessibilityState={{ selected: true }}
hitSlop={12}
className="h-11 w-11 items-center justify-center"
>
<Icon name="heart" size="md" color="destructive" filled />
</Pressable>
</View>
<View className="flex-row items-center justify-between pt-2">
<Text variant="small" className="font-semibold tabular-nums">
{fmt(item.price, currency)}
</Text>
{item.soldOut ? (
<Button
variant="tinted"
size="sm"
haptic="light"
icon={<Icon name="bell" size="sm" color="#65A30D" />}
onPress={() => onNotify(item)}
accessibilityLabel={`Notify me when ${item.name} is back in stock`}
>
Notify me
</Button>
) : (
<Button
tone="inverse"
size="sm"
className="bg-[#1B1B26]"
haptic="medium"
icon={<Icon name="shopping-cart" size="sm" color="#FFFFFF" />}
onPress={() => onMoveToBag(item)}
accessibilityLabel={`Move ${item.name} to bag`}
>
Move to bag
</Button>
)}
</View>
</View>
</View>
);
}
WishlistRow.displayName = "WishlistRow";
/** Wishlist — saved items with filled-heart unsave, price, and a per-row
* "Move to bag" action (sold-out rows offer restock alerts instead). */
export function WishlistScreen({
items = DEFAULT_ITEMS,
currency = "$",
onToggle,
onMoveToBag,
onNotify,
onItemPress,
onBrowse,
onBack,
}: WishlistScreenProps) {
const haptics = useHaptic();
// Local mirror of removals so unsave/move feel alive without a wired host.
const [removedIds, setRemovedIds] = useState<Set<string>>(new Set());
const visible = items.filter((i) => !removedIds.has(i.id));
const unsave = (item: WishlistItem) => {
setRemovedIds((prev) => new Set(prev).add(item.id));
onToggle?.(item, false);
};
const moveToBag = (item: WishlistItem) => {
haptics.success();
setRemovedIds((prev) => new Set(prev).add(item.id));
onMoveToBag?.(item);
};
const insets = useSafeAreaInsets();
return (
<World primary="#65A30D">
<SafeAreaView className="flex-1 bg-[#F4F5F9] dark:bg-[#111114]" edges={["top"]}>
{/* Floating chrome — back disc + centered title pill. */}
<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 pointerEvents="none" className="absolute inset-0 items-center justify-center">
<View className="h-11 flex-row items-center justify-center gap-2 rounded-full pl-3.5 pr-5">
<Glass effect="regular" className="absolute inset-0 rounded-full" />
<LumioMark size={18} />
<Text accessibilityRole="header" className="text-sm font-bold tracking-tight">
Saved{visible.length > 0 ? ` (${visible.length})` : ""}
</Text>
</View>
</View>
</View>
<FlatList
data={visible}
keyExtractor={(item) => item.id}
className="flex-1"
contentContainerClassName="px-6 pb-6"
contentContainerStyle={{ paddingTop: insets.top + 60 }}
showsVerticalScrollIndicator={false}
ListEmptyComponent={
<EmptyState
title="Nothing saved yet"
description="Tap the heart on any product and it will wait for you here."
action={
onBrowse ? (
<Button variant="secondary" onPress={onBrowse}>
Continue shopping
</Button>
) : undefined
}
className="py-24"
/>
}
ItemSeparatorComponent={() => <View className="h-4" />}
renderItem={({ item, index }) => (
<Mount delay={Math.min(index * ROW_STAGGER, ROW_STAGGER_CAP)}>
<WishlistRow
item={item}
currency={currency}
onUnsave={unsave}
onMoveToBag={moveToBag}
onNotify={(i) => onNotify?.(i)}
onPress={onItemPress}
/>
</Mount>
)}
/>
</SafeAreaView>
</World>
);
}
WishlistScreen.displayName = "WishlistScreen";
```
Screen: https://lumioui.dev/screens/ecommerce-wishlist