Starred messages with jump-to-chat
import * as React from "react";
import { ScrollView, View } from "react-native";
import { SafeAreaView, useSafeAreaInsets } from "react-native-safe-area-context";
import { Avatar, Button, EmptyState, Glass, Icon, Text, } from "@lumioui/ui";
import { useHaptic } from "@lumioui/core";
import { Mount, Press } from "../shared";
export interface StarredMessage {
id: string;
sender: string;
avatarUrl?: string;
text: string;
/** Which chat it came from. */
chat: string;
time: string;
/** Section bucket for the list header. */
section?: "This week" | "Earlier";
}
export interface StarredMessagesScreenProps {
messages?: StarredMessage[];
onJumpTo?: (id: string) => void;
onUnstar?: (id: string) => void;
onBack?: () => void;
}
const face = (n: number) => `https://i.pravatar.cc/150?img=${n}`;
const DEFAULT_MESSAGES: StarredMessage[] = [
{ id: "s1", sender: "Elena Ruiz", avatarUrl: face(24), text: "Gate moved to B14 — boarding at 6:05", chat: "Studio Offsite", time: "Tue 5:12 PM", section: "This week" },
{ id: "s2", sender: "Milo Park", avatarUrl: face(15), text: "Final numbers: 18 seats, $214/person", chat: "Design crit", time: "Mon 11:40 AM", section: "This week" },
{ id: "s3", sender: "Sofia Kim", avatarUrl: face(45), text: "The Figma branch is merged — tokens are live", chat: "product-design", time: "Sep 18", section: "Earlier" },
{ id: "s4", sender: "Maya Chen", avatarUrl: face(47), text: "Wifi: SunnySide_5G · pw: golden-hour", chat: "Maya Chen", time: "Sep 16", section: "Earlier" },
{ id: "s5", sender: "Tom Reed", avatarUrl: face(12), text: "Booking ref KX7-2290 — check-in opens 24h before", chat: "Lisbon trip", time: "Sep 12", section: "Earlier" },
{ id: "s6", sender: "Priya Nair", avatarUrl: face(32), text: "Icon grid audit notes in the doc I linked", chat: "Design Team", time: "Sep 9", section: "Earlier" },
{ id: "s7", sender: "Amara Chen", avatarUrl: face(9), text: "Invoice #INV-0412 paid — receipt attached", chat: "Amara Chen", time: "Aug 28", section: "Earlier" },
];
/** Starred messages — saved messages with jump-to-chat and unstar. */
export function StarredMessagesScreen({
messages = DEFAULT_MESSAGES,
onJumpTo,
onUnstar,
onBack,
}: StarredMessagesScreenProps) {
const haptics = useHaptic();
const insets = useSafeAreaInsets();
const [items, setItems] = React.useState(messages);
React.useEffect(() => setItems(messages), [messages]);
return (
<SafeAreaView className="flex-1 bg-[#F4F5F9] dark:bg-[#111114]" edges={["top"]}>
{/* Floating chrome — back pill + hug-label title pill + trash 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 w-11 items-center justify-center rounded-full"
>
<Button
variant="ghost"
size="icon"
haptic="light"
onPress={() => haptics.light()}
accessibilityLabel="Manage starred"
className="h-9 w-9"
>
<Icon name="trash" size="md" color="foreground" />
</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">
Starred
</Text>
</Glass>
</View>
</View>
{items.length === 0 ? (
<Mount className="flex-1 items-center justify-center px-8">
<EmptyState
icon={<Icon name="star" size="lg" color="mutedForeground" />}
title="No starred messages"
description="Long-press any message and tap Star to keep it here."
/>
</Mount>
) : (
<ScrollView
showsVerticalScrollIndicator={false}
contentContainerStyle={{ paddingTop: insets.top + 60, paddingBottom: insets.bottom + 32 }}
contentContainerClassName="px-4"
>
{(["This week", "Earlier"] as const).map((section) => {
const rows = items.filter(
(m) => (m.section ?? "Earlier") === section
);
if (rows.length === 0) return null;
return (
<View key={section}>
<Text
variant="small"
className="px-2 pb-2 pt-5 font-medium uppercase tracking-widest text-muted-foreground"
accessibilityRole="header"
>
{section}
</Text>
<View className="gap-3">
{rows.map((m) => (
// Quote card — amber star rail + the saved line as the
// headline, sender provenance underneath.
<View
key={m.id}
className="overflow-hidden rounded-3xl"
>
<Glass interactive effect="clear" sheen={0.5} className="absolute inset-0 rounded-3xl" pointerEvents="none" />
<View className="flex-row">
<Press
haptic="light"
onPress={() => onJumpTo?.(m.id)}
accessibilityLabel={`Open message from ${m.sender} in ${m.chat}`}
className="flex-1 items-start rounded-none bg-[#FFFBEB] p-4 dark:bg-[#1F1C12]"
>
<View className="flex-1">
<Text className="text-[15px] font-medium leading-snug">
{m.text}
</Text>
<View className="mt-3 flex-row items-center gap-2">
<Avatar
size="sm"
source={m.avatarUrl ? { uri: m.avatarUrl } : undefined}
fallback={m.sender}
alt={m.sender}
/>
<Text variant="muted" className="flex-1 text-xs">
{m.sender} · {m.chat} · {m.time}
</Text>
</View>
</View>
</Press>
<Button
variant="ghost"
size="icon"
haptic="light"
onPress={() => {
haptics.selection();
setItems((p) => p.filter((x) => x.id !== m.id));
onUnstar?.(m.id);
}}
accessibilityLabel={`Unstar message from ${m.sender}`}
className="m-2 h-9 w-9 self-start"
>
<Icon name="star" size="sm" color="#F59E0B" filled />
</Button>
</View>
</View>
))}
</View>
</View>
);
})}
</ScrollView>
)}
</SafeAreaView>
);
}
StarredMessagesScreen.displayName = "StarredMessagesScreen";
Recreate the "Starred Messages Screen" screen in React Native using LumioUI.
Goal: Starred messages with jump-to-chat 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 chat-starred-messages
```
Or pull just the components: `npx lumioui add avatar button empty-state icon 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
### `avatar` — Circular user image with fallback initials and status dot.
- `<Avatar>` ×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>` ×4
### `list` — Settings-style rows with separators and press feedback.
- imported but not rendered directly — likely used through a sibling or as a utility
### `text` — Themed type scale from caption to display.
- `<Text>` ×4
## 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/chat/starred-messages.tsx` exporting StarredMessagesScreen. 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 { Avatar, Button, EmptyState, Glass, Icon, Text, } from "@lumioui/ui";
import { useHaptic } from "@lumioui/core";
import { Mount, Press } from "../shared";
export interface StarredMessage {
id: string;
sender: string;
avatarUrl?: string;
text: string;
/** Which chat it came from. */
chat: string;
time: string;
/** Section bucket for the list header. */
section?: "This week" | "Earlier";
}
export interface StarredMessagesScreenProps {
messages?: StarredMessage[];
onJumpTo?: (id: string) => void;
onUnstar?: (id: string) => void;
onBack?: () => void;
}
const face = (n: number) => `https://i.pravatar.cc/150?img=${n}`;
const DEFAULT_MESSAGES: StarredMessage[] = [
{ id: "s1", sender: "Elena Ruiz", avatarUrl: face(24), text: "Gate moved to B14 — boarding at 6:05", chat: "Studio Offsite", time: "Tue 5:12 PM", section: "This week" },
{ id: "s2", sender: "Milo Park", avatarUrl: face(15), text: "Final numbers: 18 seats, $214/person", chat: "Design crit", time: "Mon 11:40 AM", section: "This week" },
{ id: "s3", sender: "Sofia Kim", avatarUrl: face(45), text: "The Figma branch is merged — tokens are live", chat: "product-design", time: "Sep 18", section: "Earlier" },
{ id: "s4", sender: "Maya Chen", avatarUrl: face(47), text: "Wifi: SunnySide_5G · pw: golden-hour", chat: "Maya Chen", time: "Sep 16", section: "Earlier" },
{ id: "s5", sender: "Tom Reed", avatarUrl: face(12), text: "Booking ref KX7-2290 — check-in opens 24h before", chat: "Lisbon trip", time: "Sep 12", section: "Earlier" },
{ id: "s6", sender: "Priya Nair", avatarUrl: face(32), text: "Icon grid audit notes in the doc I linked", chat: "Design Team", time: "Sep 9", section: "Earlier" },
{ id: "s7", sender: "Amara Chen", avatarUrl: face(9), text: "Invoice #INV-0412 paid — receipt attached", chat: "Amara Chen", time: "Aug 28", section: "Earlier" },
];
/** Starred messages — saved messages with jump-to-chat and unstar. */
export function StarredMessagesScreen({
messages = DEFAULT_MESSAGES,
onJumpTo,
onUnstar,
onBack,
}: StarredMessagesScreenProps) {
const haptics = useHaptic();
const insets = useSafeAreaInsets();
const [items, setItems] = React.useState(messages);
React.useEffect(() => setItems(messages), [messages]);
return (
<SafeAreaView className="flex-1 bg-[#F4F5F9] dark:bg-[#111114]" edges={["top"]}>
{/* Floating chrome — back pill + hug-label title pill + trash 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 w-11 items-center justify-center rounded-full"
>
<Button
variant="ghost"
size="icon"
haptic="light"
onPress={() => haptics.light()}
accessibilityLabel="Manage starred"
className="h-9 w-9"
>
<Icon name="trash" size="md" color="foreground" />
</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">
Starred
</Text>
</Glass>
</View>
</View>
{items.length === 0 ? (
<Mount className="flex-1 items-center justify-center px-8">
<EmptyState
icon={<Icon name="star" size="lg" color="mutedForeground" />}
title="No starred messages"
description="Long-press any message and tap Star to keep it here."
/>
</Mount>
) : (
<ScrollView
showsVerticalScrollIndicator={false}
contentContainerStyle={{ paddingTop: insets.top + 60, paddingBottom: insets.bottom + 32 }}
contentContainerClassName="px-4"
>
{(["This week", "Earlier"] as const).map((section) => {
const rows = items.filter(
(m) => (m.section ?? "Earlier") === section
);
if (rows.length === 0) return null;
return (
<View key={section}>
<Text
variant="small"
className="px-2 pb-2 pt-5 font-medium uppercase tracking-widest text-muted-foreground"
accessibilityRole="header"
>
{section}
</Text>
<View className="gap-3">
{rows.map((m) => (
// Quote card — amber star rail + the saved line as the
// headline, sender provenance underneath.
<View
key={m.id}
className="overflow-hidden rounded-3xl"
>
<Glass interactive effect="clear" sheen={0.5} className="absolute inset-0 rounded-3xl" pointerEvents="none" />
<View className="flex-row">
<Press
haptic="light"
onPress={() => onJumpTo?.(m.id)}
accessibilityLabel={`Open message from ${m.sender} in ${m.chat}`}
className="flex-1 items-start rounded-none bg-[#FFFBEB] p-4 dark:bg-[#1F1C12]"
>
<View className="flex-1">
<Text className="text-[15px] font-medium leading-snug">
{m.text}
</Text>
<View className="mt-3 flex-row items-center gap-2">
<Avatar
size="sm"
source={m.avatarUrl ? { uri: m.avatarUrl } : undefined}
fallback={m.sender}
alt={m.sender}
/>
<Text variant="muted" className="flex-1 text-xs">
{m.sender} · {m.chat} · {m.time}
</Text>
</View>
</View>
</Press>
<Button
variant="ghost"
size="icon"
haptic="light"
onPress={() => {
haptics.selection();
setItems((p) => p.filter((x) => x.id !== m.id));
onUnstar?.(m.id);
}}
accessibilityLabel={`Unstar message from ${m.sender}`}
className="m-2 h-9 w-9 self-start"
>
<Icon name="star" size="sm" color="#F59E0B" filled />
</Button>
</View>
</View>
))}
</View>
</View>
);
})}
</ScrollView>
)}
</SafeAreaView>
);
}
StarredMessagesScreen.displayName = "StarredMessagesScreen";
```
Screen: https://lumioui.dev/screens/chat-starred-messages