Sleep Stage Hypnogram and Range Bars
A black sleep screen shows last night's duration and a Stages card with four stepped rows (awake, REM, light, deep) on a 12 am to 7 am axis. A second card plots 14 rounded bars of bed times, coffee nights tinted, with 11 pm and 7 am target lines.
export function Example() {
const progress = useSharedValue(0);
…
Agent prompt
Add the Now In Code component "sleep-stage-hypnogram-and-range-bars" to this project. The full source is attached at the end of this prompt. Put the files under components/sleep-stage-hypnogram-and-range-bars/, install the listed dependencies with `npx expo install`, and render it on a route I can open. Keep the timing and easing values documented in the source comments. Replace the sample copy and artwork with content from my app, or leave placeholders and list what I still need to supply. === Source files are attached here for paid plans ===
Details
- Platforms
- iOS, Android
- Requires
- Expo SDK 54+
- Access
- Pro
- Updated
- 20 Nov 2026
- License
- Unlimited commercial projects
- Original design
- @ux_tanvir on X
Are you the designer? Ask us to change or remove this.
Add pieces from the terminal or let your agent fetch them. Until then, Copy prompt does the same job. Docs
What it does
A dark sleep detail page for the previous night. A purple oval glow sits behind a title, a date, a large duration, a small pill comparing it with the average and the time in bed. Below are two rounded cards. The first draws sleep stages as a stepped chart with four rows for awake, REM, light and deep sleep, colored blocks joined by gray vertical connectors, dotted hourly guides and a legend with durations. The second shows the last fourteen nights as range bars from bedtime to wake time, with the latest night in white, two dashed target lines and an insight row with a cup icon and two lines of text.
How it's built
The page is a static display list produced by a shared JavaScript core: rectangles, circles, lines, paths and text with one elliptical radial gradient, all in points. The React Native component maps those nodes onto react-native-svg inside a viewBox scaled to the given width, and can sit in a ScrollView. Chart data is stored as minute values. No chart library is used; the stepped stage chart and range bars are plain shapes. A hook loads four font weights through expo-font and text waits until they are ready.
Good for
- A sleep, nap or rest tracking detail screen
- Any timeline of discrete states over a night or day, such as activity levels
- A weekly or biweekly range view showing consistency of start and end times
Dependencies
expo-fontreact-native-svgreact-native