Sleep Tracker
Health Pro
Review last night on a sleep chart you can scrub by finger, the screen brightening toward morning as you near wake time. Stage breakdown, a week of bedtimes, vitals and a smart alarm follow.
More in Health
View all 22Agent prompt
Paste into Claude Code, Cursor or Devin to rebuild this screen.
Recreate the "Sleep Tracker" screen in React Native using LumioUI.
Goal: Review last night on a sleep chart you can scrub by finger, the screen brightening toward morning as you near wake time. Stage breakdown, a week of bedtimes, vitals and a smart alarm follow. 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/cli add pro/health-sleep-tracker
```
Or pull just the components: `npx @lumioui/cli add animated-number icon progress-ring pro/sparkline switch text`
Native packages:
- react-native-reanimated@*
- react-native-safe-area-context@*
- react-native-svg@*
Stack assumptions: Expo SDK 54 / RN 0.81, Reanimated 4, NativeWind v4, TypeScript strict, Expo Go compatible.
## Components — how, where, when
### `animated-number` — Number that moves to each new value as a calm count-up or a roll where only the changed digits turn, set in type or in dot-matrix LEDs whose dots switch on in place. Screen readers announce just the final value, not every step.
- `<AnimatedNumber>` ×2 — The night's total counts up as the hypnogram draws across.
### `icon` — Icon set drawn on one consistent grid, sized and coloured from your theme. The heart, star and bookmark can fill in place inside their outline, then fade back out.
- `<Icon>` ×4
### `progress-ring` — Circular progress ring with a bright bead on its leading edge. Reaching 100% brightens the ring and briefly turns any centre figure into a check; an indeterminate mode laps the track.
- `<ProgressRing>` ×1
### `sparkline` — Small trend line with an end dot that draws itself in and tints up or down. New data reshapes the line smoothly, and it can follow your finger with a cursor so your app shows the value.
- `<Sparkline>` ×1
### `switch` — On/off switch whose colour fills in from behind the thumb as it turns on. Turning off fades it back quickly, and a disabled switch gives a gentle flicker when tapped.
- `<Switch>` ×1
### `text` — Themed type scale from caption to display that follows light and dark mode. Includes a pull-quote style with an accent rule and a quieter dimmed tone for secondary text.
- `<Text>` ×28
## 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/sleep-tracker.tsx` exporting SleepTrackerScreen. Preserve the props interface — the host app wires the callbacks (navigation, submit handlers) through them.
## Reference implementation
This is a LumioUI Pro item: its source is not published in the docs. Install it with a Pro license key
(set `LUMIO_LICENSE_KEY`; keys are on lumioui.com/account) and read the installed file as the reference:
```bash
npx @lumioui/cli add pro/health-sleep-tracker
```
The source lands at `screens/health/sleep-tracker.tsx`.
Screen: https://lumioui.com/screens/health-sleep-tracker