Skip to content
Native Animation
Recovery Readiness Chart animation preview

This preview uses fictional demo content. See the props below for the customization options available in this component.

npx nativeanimation add recovery-readiness-chart
Chart

Recovery Readiness Chart

A recovery dashboard with a scrubbable readiness curve and configurable series, metrics, chart colors, and title font.

$9 for this animation

Add to your project

Copy the component and its assets into your app with the Native Animation CLI, or paste the agent prompt into Claude Code, Codex or Cursor once the MCP server is connected.

About this animation

A recovery dashboard with a scrubbable readiness curve and configurable series, metrics, chart colors, and title font.

Why this one

Readiness charts are usually static. Here, scrubbing the curve updates the headline score and marker together while the planetary horizon anchors the whole recovery session.

How it works

  1. Measure the chart and build hourly Catmull–Rom curve segments in Skia.
  2. Evaluate those same segments for the scrub marker and its value label.
  3. Keep the marker on a shared progress value; release springs it back to currentHour.
  4. Update the elapsed clock from the session start time and render the supplied progress bars.
  5. Complete the session through the end slider or public ref and report onEnd to the host.

Install

Copy the files listed in piece.json into your project. Install SDK-compatible dependencies:

npx expo install @shopify/react-native-skia expo-linear-gradient react-native-gesture-handler react-native-reanimated react-native-worklets

Mount below a GestureHandlerRootView and load host fonts before rendering. Initialize CanvasKit before mounting Skia on web.

Usage

<RecoveryReadinessChart
  readiness={74}
  series={[46, 43, 49, 61, 65, 52, 46, 49, 61, 73, 78, 84, 91, 96, 89, 76, 61, 50, 45, 48, 55, 64, 67, 60]}
  onScrub={(hour, value) => console.log(hour, value)}
  onEnd={() => saveSession()}
/>

Props

PropTypeDefaultDescription
titlestring'Active Recovery'Main session heading.
subtitlestring'Your body is recharging.'Supporting session copy.
titleFontFamilystring'Geist_300Light'Display title font; load it in the host or supply a host-loaded family.
zoneLabelstring'RECOVERY ZONE'Centered navigation label.
metricsRecoveryMetric[]Three metrics listed belowSummary headings, values, and units; duration updates from the session clock.
startedAtDateMount time minus 34 min 26 secSession start used to calculate live elapsed duration.
readinessnumber74Resting readiness score from 0 to 100.
readinessLabelstring'Good'Readiness descriptor and chart accessibility label.
deltastring'+12%'Displayed change from the previous day.
seriesnumber[]24 hourly values listed belowHourly curve data; supply 24 readiness scores from 0 to 100.
barsRecoveryBar[]Two bars listed belowLower progress summaries with labels, display values, progress, and colors.
endLabelstring'End Session'Active session slider text and accessible name.
savedLabelstring'Session saved'Completed slider text and accessible name.
colors{ gradient: [string, string, ...string[]]; accent: string; background: string }Palette listed belowComplete gradient and surface override; supply every field.
onInteractionStart() => voidundefinedCalled when chart touch or accessibility interaction starts; stop host autoplay here.
onEnd() => voidundefinedNotifies the host when the slider or ref completes the session.
currentHournumberCurrent local hourMarker rest position, clamped to 0–23.
onScrub(hour: number, value: number) => voidundefinedReports the requested fractional hour and rounded smooth-curve score.

Data and palette defaults

RecoveryMetric is { label: string; value: string; unit: string }. Default metrics are { label: 'DURATION', value: '34:26', unit: 'min' }, { label: 'DISTANCE', value: '3.24', unit: 'mi' }, and { label: 'EFFORT', value: '68%', unit: 'Moderate' }.

RecoveryBar is { label: string; value: string; progress: number; color: string }. Default bars are { label: 'HRV BALANCE', value: '68 ms', progress: 0.78, color: '#A855F7' } and { label: 'RECOVERY TREND', value: 'Rising ↗', progress: 0.76, color: '#D9F99D' }.

The default series is [48, 43, 45, 59, 62, 54, 47, 46, 51, 61, 70, 75, 81, 89, 95, 94, 83, 65, 51, 47, 49, 57, 63, 61]. Default colors is { gradient: ['#8B46EE', '#FFC46B', '#F8DC47'], accent: '#8B5CF6', background: '#050507' }.

Ref

Pass ref={sessionRef} with useRef<RecoveryReadinessChartRef>(null). The optional ref has no default and exposes scrubTo(hour: number): void, release(): void to return to the resting hour, end(): void to complete and call onEnd, and reset(): void to restore the active session and resting marker. Import the component and ref type from this folder's index.ts.

Chart interaction

The marker evaluates the same hourly Catmull–Rom cubic segments as the rendered curve, including during its interruptible spring return to currentHour. The white marker has a gradient-colored ring and soft halo; its guide ends at the bottom axis. A bounded floating label shows 24-hour time and the rounded curve value. Future data is dimmed through two complementary clips.

onInteractionStart?: () => void fires when chart touch or accessibility interaction starts, so external playback can stop. The demo stops its autoplay timers on interaction. scrubTo(hour) accepts fractional hours; onScrub reports the rounded smooth-curve value. Reduced motion moves directly to the requested hour.

The screen caps its content width at 480 pt. Containers shorter than 680 pt scroll vertically so the chart, floating label, axes, and session control retain their spacing. The host screen applies safe-area insets.

Compatibility

  • Expo SDK 58
  • React Native 0.88
  • iOS, Android, and web

Accessibility

The chart exposes an adjustable role, the readiness label and value, and increment/decrement actions as an alternative to scrubbing. The session control exposes a button role and uses endLabel or savedLabel as its accessible name. Reduced motion places the chart marker directly at the requested hour and skips the entrance travel; the session slider retains its spring.