Sleep Quiz Ruler and Breathing
A sleep quiz has a ruler that snaps every 5 minutes with inertia, the home screen has tappable mood dots and a springy tab selector, and a breathing screen cycles inhale, hold, exhale, hold for 4s each with a scaling ring.
export function Example() {
const progress = useSharedValue(0);
…
Agent prompt
Add the Now In Code component "sleep-quiz-ruler-and-breathing" to this project. The full source is attached at the end of this prompt. Put the files under components/sleep-quiz-ruler-and-breathing/, 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
- 28 Oct 2026
- License
- Unlimited commercial projects
- Original design
- @uiuxjoy99 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
Three screens of a sleep and mindfulness app in one flow. The first is a sleep question with a horizontal ruler. Dragging it changes the duration in five-minute steps, and on release it coasts and settles onto a mark, while a three-segment progress bar advances with Next and Skip. The second is a home screen with a greeting, a wind-down card with a play button, mood circles that cycle through faces when tapped, and a tab bar whose selection block slides. The third is box breathing, where a face and two rings expand and contract through inhale, hold, exhale and hold, with a timer and a round counter.
How it's built
A shared JavaScript core keeps the state, produces a display list of rectangles, baseline-positioned text, SVG groups and icons, and handles hit tests plus pointer down, move and up. The React Native component maps nodes to views and react-native-svg, with fonts from expo-font. The ruler uses a velocity estimate from the last moments of the drag and an ease-out snap, and the breathing scale follows a sine ease across four equal phases. The illustrations are traced strokes converted to curves. Everything runs on a requestAnimationFrame loop and no animation library.
Good for
- Sleep, meditation or wellness apps with a check-in flow
- A ruler-style picker for durations or measurements
- A guided breathing screen with phase labels and a timer
Dependencies
react-native-svgexpo-fontreact-native