Skip to content
Native Animation
Drag Star Rating animation preview

Drag Star Rating

A five-star control that fills under a drag, lights each star, and celebrates a perfect rating.

$9 for this animation

Checkout opens soon. Leave your email and we will tell you the moment you can buy it.

One email when checkout opens. No spam.

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.

npx nativeanimation add drag-star-rating

About this animation

A five-star control that fills under a drag, lights each star, and celebrates a perfect rating.

How it works

  1. Five reusable Skia star paths render an empty layer and a clipped color layer.
  2. Horizontal gesture position is quantized to whole or half steps and written to one shared rating value.
  3. Each star watches its own fill threshold on the UI thread and runs a short independent jump.
  4. The release commits through the controlled or uncontrolled API; read-only values use the same partial fill.
  5. Reaching five stars triggers a short surface pop and expanding completion ring.

Install

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

For web, follow Expo's Skia CanvasKit setup if your bundler does not already copy the WASM asset.

Usage

<DragStarRating defaultValue={3} onChange={setRating} />

<DragStarRating value={rating} onChange={setRating} allowHalf size={40} color="#F2B544" />

<DragStarRating colorScheme="dark" variant="bold" glowColor="#FF5A4E" />

Props

PropTypeDefaultDescription
valuenumber—Controlled rating.
defaultValuenumber0Initial uncontrolled rating.
onChange(value: number) => void—Receives committed ratings.
allowHalfbooleanfalseEnables half-star steps.
readOnlybooleanfalseDisables interaction.
sizenumber36Star size.
gapnumber7Space between stars.
colorstring'#F2B544'Filled color.
emptyColorstring'#D9D9E0'Empty color.
colorScheme'light' | 'dark' | 'auto''auto'Material default appearance.
variant'soft' | 'glass' | 'bold''soft'Surface personality.
glowColorstringcolorPerfect-rating glow color.
jumpHeightnumber0.16Jump height relative to star size.
jumpDurationnumber110Jump-up duration in milliseconds.
accessibilityLabelstring'Star rating'Screen-reader label.
styleStyleProp<ViewStyle>—Outer style.
testIDstring—Test identifier.

The ref exposes setValue(value) and reset().

Compatibility

  • Expo SDK 57, React Native 0.86, Reanimated 4.5, Skia 2.6
  • iOS and Android supported but not device-verified; web verified by the project gate
  • Works in Expo Go

Accessibility

The component is an adjustable control with its current value announced in stars. Increment and decrement actions honor half steps; read-only mode is disabled. Reduced Motion removes the jump while preserving fill changes.