Concentric rings with per-ring stats
import * as React from "react";
import { ScrollView, View } from "react-native";
import { SafeAreaView, useSafeAreaInsets } from "react-native-safe-area-context";
import { Glass, Icon, type IconName, List, ProgressRing, Text } from "@lumioui/ui";
import { cn } from "@lumioui/core";
import { BLOCK_STAGGER, GlowSpot, type IconTone, LumioMark, Mount, Press, RowIcon, SEPARATOR_INSET, World } from "../shared";
export interface Ring {
id: string;
label: string;
/** e.g. "420/800 cal" */
progress: string;
pct: number;
color: string;
}
export interface ActivityRingsScreenProps {
day?: string;
rings?: Ring[];
onShare?: () => void;
onBack?: () => void;
}
const DEFAULT_RINGS: Ring[] = [
{ id: "move", label: "Move", progress: "496/800 CAL", pct: 62, color: "border-destructive" },
{ id: "exercise", label: "Exercise", progress: "24/30 MIN", pct: 80, color: "border-success" },
{ id: "stand", label: "Stand", progress: "6/12 HRS", pct: 50, color: "border-[#16A34A]" },
];
/** "border-destructive" -> "destructive" for ProgressRing's color token. */
const ringToken = (color: string) =>
color.replace(/^border-/, "") as React.ComponentProps<typeof ProgressRing>["color"];
// Concentric sizing mirrors Apple's watch rings — outer/mid/inner.
const RING_SPECS = [
{ size: 184, strokeWidth: 14 },
{ size: 120, strokeWidth: 11 },
{ size: 72, strokeWidth: 8 },
] as const;
/** Trailing 7-day bars per trend — last bar is today. */
const TRENDS: {
title: string;
subtitle: string;
icon: IconName;
tone: IconTone;
up: boolean;
bars: number[];
}[] = [
{ title: "Move", subtitle: "Average 388 cal", icon: "flame", tone: "red", up: true, bars: [62, 45, 78, 55, 70, 88, 62] },
{ title: "Exercise", subtitle: "Average 31 min", icon: "footprints", tone: "green", up: true, bars: [40, 66, 52, 80, 48, 90, 80] },
{ title: "Stand", subtitle: "Average 9 hrs", icon: "clock", tone: "blue", up: false, bars: [80, 72, 90, 60, 55, 70, 50] },
];
/** Activity rings — concentric ring hero + per-ring stat rows. */
export function ActivityRingsScreen({
day = "Friday",
rings = DEFAULT_RINGS,
onShare,
onBack,
}: ActivityRingsScreenProps) {
const insets = useSafeAreaInsets();
return (
<World primary="#16A34A">
<SafeAreaView className="flex-1 bg-[#0A0D0B] dark:bg-[#0A0D0B]" edges={["top"]}>
<GlowSpot color="#FA5C4F" size={260} className="-top-16 right-[-80px]" />
<GlowSpot color="#7FEB6B" size={220} className="bottom-[30%] left-[-100px]" />
<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" tintColor="#FFFFFF16" 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="#F5F7F5" />
</Press>
</Glass>
<Glass interactive effect="regular" tintColor="#FFFFFF16" className="h-11 w-11 items-center justify-center rounded-full">
<Press
haptic="light"
onPress={() => onShare?.()}
accessibilityRole="button"
accessibilityLabel="Share activity"
className="h-9 w-9 items-center justify-center"
>
<Icon name="share" size="sm" color="#F5F7F5" />
</Press>
</Glass>
</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" tintColor="#FFFFFF16" className="absolute inset-0 rounded-full" />
<LumioMark size={18} />
<Text accessibilityRole="header" className="text-sm font-bold tracking-tight text-[#F5F7F5]">
Activity
</Text>
</View>
</View>
</View>
{/* Rings hero — real progress arcs, not closed circles. */}
<View className="items-center" style={{ paddingTop: insets.top + 64 }}>
<ProgressRing
value={rings[0]?.pct ?? 0}
size={RING_SPECS[0].size}
strokeWidth={RING_SPECS[0].strokeWidth}
color={ringToken(rings[0]?.color ?? "destructive")}
label={`${rings[0]?.label ?? "Move"} ring`}
>
<ProgressRing
value={rings[1]?.pct ?? 0}
size={RING_SPECS[1].size}
strokeWidth={RING_SPECS[1].strokeWidth}
color={ringToken(rings[1]?.color ?? "success")}
label={`${rings[1]?.label ?? "Exercise"} ring`}
>
<ProgressRing
value={rings[2]?.pct ?? 0}
size={RING_SPECS[2].size}
strokeWidth={RING_SPECS[2].strokeWidth}
color={ringToken(rings[2]?.color ?? "primary")}
label={`${rings[2]?.label ?? "Stand"} ring`}
>
<Icon name="flame" size="sm" color="destructive" filled />
</ProgressRing>
</ProgressRing>
</ProgressRing>
{/* Ring-center summary — kcal done + rings still open. */}
<Text className="mt-4 text-2xl font-semibold tabular-nums text-[#F5F7F5]">
496 <Text className="text-base font-normal text-[#8A938C]">kcal</Text>
</Text>
<Text className="mt-0.5 text-xs text-[#8A938C]">
2 of 3 rings to close today
</Text>
</View>
{/* Day + ring stats. */}
<ScrollView
showsVerticalScrollIndicator={false}
contentContainerStyle={{ paddingBottom: insets.bottom + 32 }}
>
<View className="px-4 pb-2 pt-6">
<Text variant="h4" className="text-[#F5F7F5]">{day}</Text>
{/* Move streak — the number people protect. */}
<Text className="pt-0.5 text-xs text-[#F5F7F5]/50">
12-day move streak · 62% to goal
</Text>
</View>
<Mount delay={BLOCK_STAGGER} className="mx-4 overflow-hidden rounded-3xl">
<Glass interactive effect="regular" sheen={0.4} tintColor="#FFFFFF12" className="absolute inset-0 rounded-3xl" pointerEvents="none" />
{rings.map((r, ii) => (
<React.Fragment key={r.id}>
{ii > 0 && <List.Separator className={cn(SEPARATOR_INSET, "bg-white/10")} />}
<List.Item
title={r.label}
titleClassName="text-[#F5F7F5]"
leading={
<View
className={`h-8 w-8 items-center justify-center rounded-full border-[5px] ${r.color}`}
/>
}
trailing={
<View className="items-end">
<Text className="font-medium text-[#F5F7F5]">{r.progress}</Text>
<Text className="text-xs text-[#8A938C]">
{r.pct}%
</Text>
</View>
}
className="py-3.5"
/>
</React.Fragment>
))}
</Mount>
{/* Trends — the trailing 7-day arrows Apple Fitness shows. */}
<View className="px-4 pb-2 pt-6">
<Text variant="h4" className="text-[#F5F7F5]">Trends</Text>
</View>
<View className="mx-4 overflow-hidden rounded-3xl">
<Glass interactive effect="regular" sheen={0.4} tintColor="#FFFFFF12" className="absolute inset-0 rounded-3xl" pointerEvents="none" />
{TRENDS.map((t, ii) => (
<React.Fragment key={t.title}>
{ii > 0 && <List.Separator className={cn(SEPARATOR_INSET, "bg-white/10")} />}
<List.Item
title={t.title}
titleClassName="text-[#F5F7F5]"
subtitleClassName="text-[#8A938C]"
subtitle={t.subtitle}
leading={<RowIcon name={t.icon} tone={t.tone} />}
trailing={
<View className="flex-row items-center gap-2">
{/* 7-day mini column chart — today is the accent bar. */}
<View className="flex-row items-end gap-[3px]">
{t.bars.map((v, bi) => (
<View
key={bi}
className={`w-[3px] rounded-full ${
bi === t.bars.length - 1
? t.up
? "bg-success"
: "bg-muted-foreground"
: "bg-muted"
}`}
style={{ height: 4 + (v / 100) * 18 }}
/>
))}
</View>
<Icon
name={t.up ? "arrow-up" : "arrow-down"}
size="sm"
color={t.up ? "success" : "mutedForeground"}
/>
</View>
}
className="py-3.5"
/>
</React.Fragment>
))}
</View>
{/* Awards strip — the motivational detail below the rings. */}
<View className="mx-4 mt-5 flex-row items-center justify-between overflow-hidden rounded-2xl p-4">
<Glass interactive effect="regular" sheen={0.4} tintColor="#FFFFFF12" className="absolute inset-0 rounded-2xl" pointerEvents="none" />
<View className="flex-row items-center gap-3">
<View className="h-10 w-10 items-center justify-center rounded-full bg-warning/20">
<Icon name="crown" size="sm" color="warning" />
</View>
<View>
<Text className="text-sm font-semibold">Closest award</Text>
<Text className="text-xs text-muted-foreground">
7-day move streak · 5 days to go
</Text>
</View>
</View>
<Icon name="chevron-right" size="sm" color="mutedForeground" />
</View>
</ScrollView>
</SafeAreaView>
</World>
);
}
ActivityRingsScreen.displayName = "ActivityRingsScreen";
Recreate the "Activity Rings Screen" screen in React Native using LumioUI.
Goal: Concentric rings with per-ring stats 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 health-activity-rings
```
Or pull just the components: `npx lumioui add button icon list progress-ring 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.
- imported but not rendered directly — likely used through a sibling or as a utility
### `icon` — Lucide icon set mapped to theme colors and sizes.
- `<Icon>` ×6
### `list` — Settings-style rows with separators and press feedback.
- imported but not rendered directly — likely used through a sibling or as a utility
### `progress-ring` — Circular progress ring with animated stroke arc, center slot and indeterminate spin.
- `<ProgressRing>` ×3
### `text` — Themed type scale from caption to display.
- `<Text>` ×11
## 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/health/activity-rings.tsx` exporting ActivityRingsScreen. 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 { Glass, Icon, type IconName, List, ProgressRing, Text } from "@lumioui/ui";
import { cn } from "@lumioui/core";
import { BLOCK_STAGGER, GlowSpot, type IconTone, LumioMark, Mount, Press, RowIcon, SEPARATOR_INSET, World } from "../shared";
export interface Ring {
id: string;
label: string;
/** e.g. "420/800 cal" */
progress: string;
pct: number;
color: string;
}
export interface ActivityRingsScreenProps {
day?: string;
rings?: Ring[];
onShare?: () => void;
onBack?: () => void;
}
const DEFAULT_RINGS: Ring[] = [
{ id: "move", label: "Move", progress: "496/800 CAL", pct: 62, color: "border-destructive" },
{ id: "exercise", label: "Exercise", progress: "24/30 MIN", pct: 80, color: "border-success" },
{ id: "stand", label: "Stand", progress: "6/12 HRS", pct: 50, color: "border-[#16A34A]" },
];
/** "border-destructive" -> "destructive" for ProgressRing's color token. */
const ringToken = (color: string) =>
color.replace(/^border-/, "") as React.ComponentProps<typeof ProgressRing>["color"];
// Concentric sizing mirrors Apple's watch rings — outer/mid/inner.
const RING_SPECS = [
{ size: 184, strokeWidth: 14 },
{ size: 120, strokeWidth: 11 },
{ size: 72, strokeWidth: 8 },
] as const;
/** Trailing 7-day bars per trend — last bar is today. */
const TRENDS: {
title: string;
subtitle: string;
icon: IconName;
tone: IconTone;
up: boolean;
bars: number[];
}[] = [
{ title: "Move", subtitle: "Average 388 cal", icon: "flame", tone: "red", up: true, bars: [62, 45, 78, 55, 70, 88, 62] },
{ title: "Exercise", subtitle: "Average 31 min", icon: "footprints", tone: "green", up: true, bars: [40, 66, 52, 80, 48, 90, 80] },
{ title: "Stand", subtitle: "Average 9 hrs", icon: "clock", tone: "blue", up: false, bars: [80, 72, 90, 60, 55, 70, 50] },
];
/** Activity rings — concentric ring hero + per-ring stat rows. */
export function ActivityRingsScreen({
day = "Friday",
rings = DEFAULT_RINGS,
onShare,
onBack,
}: ActivityRingsScreenProps) {
const insets = useSafeAreaInsets();
return (
<World primary="#16A34A">
<SafeAreaView className="flex-1 bg-[#0A0D0B] dark:bg-[#0A0D0B]" edges={["top"]}>
<GlowSpot color="#FA5C4F" size={260} className="-top-16 right-[-80px]" />
<GlowSpot color="#7FEB6B" size={220} className="bottom-[30%] left-[-100px]" />
<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" tintColor="#FFFFFF16" 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="#F5F7F5" />
</Press>
</Glass>
<Glass interactive effect="regular" tintColor="#FFFFFF16" className="h-11 w-11 items-center justify-center rounded-full">
<Press
haptic="light"
onPress={() => onShare?.()}
accessibilityRole="button"
accessibilityLabel="Share activity"
className="h-9 w-9 items-center justify-center"
>
<Icon name="share" size="sm" color="#F5F7F5" />
</Press>
</Glass>
</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" tintColor="#FFFFFF16" className="absolute inset-0 rounded-full" />
<LumioMark size={18} />
<Text accessibilityRole="header" className="text-sm font-bold tracking-tight text-[#F5F7F5]">
Activity
</Text>
</View>
</View>
</View>
{/* Rings hero — real progress arcs, not closed circles. */}
<View className="items-center" style={{ paddingTop: insets.top + 64 }}>
<ProgressRing
value={rings[0]?.pct ?? 0}
size={RING_SPECS[0].size}
strokeWidth={RING_SPECS[0].strokeWidth}
color={ringToken(rings[0]?.color ?? "destructive")}
label={`${rings[0]?.label ?? "Move"} ring`}
>
<ProgressRing
value={rings[1]?.pct ?? 0}
size={RING_SPECS[1].size}
strokeWidth={RING_SPECS[1].strokeWidth}
color={ringToken(rings[1]?.color ?? "success")}
label={`${rings[1]?.label ?? "Exercise"} ring`}
>
<ProgressRing
value={rings[2]?.pct ?? 0}
size={RING_SPECS[2].size}
strokeWidth={RING_SPECS[2].strokeWidth}
color={ringToken(rings[2]?.color ?? "primary")}
label={`${rings[2]?.label ?? "Stand"} ring`}
>
<Icon name="flame" size="sm" color="destructive" filled />
</ProgressRing>
</ProgressRing>
</ProgressRing>
{/* Ring-center summary — kcal done + rings still open. */}
<Text className="mt-4 text-2xl font-semibold tabular-nums text-[#F5F7F5]">
496 <Text className="text-base font-normal text-[#8A938C]">kcal</Text>
</Text>
<Text className="mt-0.5 text-xs text-[#8A938C]">
2 of 3 rings to close today
</Text>
</View>
{/* Day + ring stats. */}
<ScrollView
showsVerticalScrollIndicator={false}
contentContainerStyle={{ paddingBottom: insets.bottom + 32 }}
>
<View className="px-4 pb-2 pt-6">
<Text variant="h4" className="text-[#F5F7F5]">{day}</Text>
{/* Move streak — the number people protect. */}
<Text className="pt-0.5 text-xs text-[#F5F7F5]/50">
12-day move streak · 62% to goal
</Text>
</View>
<Mount delay={BLOCK_STAGGER} className="mx-4 overflow-hidden rounded-3xl">
<Glass interactive effect="regular" sheen={0.4} tintColor="#FFFFFF12" className="absolute inset-0 rounded-3xl" pointerEvents="none" />
{rings.map((r, ii) => (
<React.Fragment key={r.id}>
{ii > 0 && <List.Separator className={cn(SEPARATOR_INSET, "bg-white/10")} />}
<List.Item
title={r.label}
titleClassName="text-[#F5F7F5]"
leading={
<View
className={`h-8 w-8 items-center justify-center rounded-full border-[5px] ${r.color}`}
/>
}
trailing={
<View className="items-end">
<Text className="font-medium text-[#F5F7F5]">{r.progress}</Text>
<Text className="text-xs text-[#8A938C]">
{r.pct}%
</Text>
</View>
}
className="py-3.5"
/>
</React.Fragment>
))}
</Mount>
{/* Trends — the trailing 7-day arrows Apple Fitness shows. */}
<View className="px-4 pb-2 pt-6">
<Text variant="h4" className="text-[#F5F7F5]">Trends</Text>
</View>
<View className="mx-4 overflow-hidden rounded-3xl">
<Glass interactive effect="regular" sheen={0.4} tintColor="#FFFFFF12" className="absolute inset-0 rounded-3xl" pointerEvents="none" />
{TRENDS.map((t, ii) => (
<React.Fragment key={t.title}>
{ii > 0 && <List.Separator className={cn(SEPARATOR_INSET, "bg-white/10")} />}
<List.Item
title={t.title}
titleClassName="text-[#F5F7F5]"
subtitleClassName="text-[#8A938C]"
subtitle={t.subtitle}
leading={<RowIcon name={t.icon} tone={t.tone} />}
trailing={
<View className="flex-row items-center gap-2">
{/* 7-day mini column chart — today is the accent bar. */}
<View className="flex-row items-end gap-[3px]">
{t.bars.map((v, bi) => (
<View
key={bi}
className={`w-[3px] rounded-full ${
bi === t.bars.length - 1
? t.up
? "bg-success"
: "bg-muted-foreground"
: "bg-muted"
}`}
style={{ height: 4 + (v / 100) * 18 }}
/>
))}
</View>
<Icon
name={t.up ? "arrow-up" : "arrow-down"}
size="sm"
color={t.up ? "success" : "mutedForeground"}
/>
</View>
}
className="py-3.5"
/>
</React.Fragment>
))}
</View>
{/* Awards strip — the motivational detail below the rings. */}
<View className="mx-4 mt-5 flex-row items-center justify-between overflow-hidden rounded-2xl p-4">
<Glass interactive effect="regular" sheen={0.4} tintColor="#FFFFFF12" className="absolute inset-0 rounded-2xl" pointerEvents="none" />
<View className="flex-row items-center gap-3">
<View className="h-10 w-10 items-center justify-center rounded-full bg-warning/20">
<Icon name="crown" size="sm" color="warning" />
</View>
<View>
<Text className="text-sm font-semibold">Closest award</Text>
<Text className="text-xs text-muted-foreground">
7-day move streak · 5 days to go
</Text>
</View>
</View>
<Icon name="chevron-right" size="sm" color="mutedForeground" />
</View>
</ScrollView>
</SafeAreaView>
</World>
);
}
ActivityRingsScreen.displayName = "ActivityRingsScreen";
```
Screen: https://lumioui.dev/screens/health-activity-rings