About this animation
A React Native product carousel can make each variant feel like a distinct product moment while keeping selection in one continuous flow. This component loops through two or more product images and synchronizes the artwork, variant name, foreground copy, and full-screen color field. Use it for colorways, finishes, packaging, accessories, or another visually led option picker. Gesture Handler writes horizontal drag progress directly to one Reanimated shared value, and every item derives its wrapped position from that value, avoiding duplicated data. Interruptible springs settle the selection and power the same imperative navigation path. Customize product geometry, purchase copy, specifications, colors, fonts, thresholds, and spring behavior, then respond to settled changes with onIndexChange.
When to use it
- Explore product colors or finishes.
- Synchronize imagery, copy, and page color.
- Loop through variants without duplicating data.
- Drive selection from gestures or external controls.
A product carousel with perspective parallax and a cap-origin color sweep, with configurable variants, specifications, purchase bar color, and fonts.
How it works
- One continuous Reanimated shared value drives the selected variant, background, product layers, circular sweep, and liquid rail.
- Wrapped distance keeps the carousel infinite while each product derives its opacity, depth, horizontal parallax, and
rotateYperspective. - A large accent field scales from the product cap during a transition, then reveals the destination background as the spring settles.
- The active rail capsule stretches between variants; tapping any capsule uses the same interruptible spring as dragging and the imperative API.
- A mirrored product layer, clipped fade, contact shadow, translucent borders, and two-layer shadows create the polished studio-floor material.
Why this one
Most color carousels stop at a centered product, title, and dots. This pattern turns selection into a compact product story: the next item arrives from depth, the environment changes from the product itself, and the rail visibly carries momentum. Capacity selection and a real purchase action make the demo useful beyond the transition.
Install
npx expo install expo-linear-gradient react-native-gesture-handler react-native-reanimated react-native-workletsMount the app under GestureHandlerRootView as described by React Native Gesture Handler.
Usage
import { VariantCarousel } from './VariantCarousel';
const variants = [
{
name: 'Sage',
image: require('./bottle-sage.png'),
backgroundColor: '#DDE5DB',
accentColor: '#81977D',
brandColor: '#81977D',
textColor: '#172019',
secondaryColor: 'rgba(23,32,25,0.58)',
},
{
name: 'Clay',
image: require('./bottle-clay.png'),
backgroundColor: '#EEE0D8',
accentColor: '#BF8068',
brandColor: '#BF8068',
textColor: '#261B17',
secondaryColor: 'rgba(38,27,23,0.58)',
},
];
export function ProductScreen() {
return <VariantCarousel variants={variants} />;
}Customize the product content and motion without changing the component:
<VariantCarousel
actionLabel="Reserve"
brandName="North"
capacities={['20 oz', '28 oz']}
onActionPress={openCheckout}
onIndexChange={setSelectedVariant}
priceLabel="$42"
productName="Trail Flask"
springDamping={26}
springStiffness={300}
titleFontFamily="InstrumentSerif_400Regular"
variants={variants}
/>Props
| Name | Type | Default | Description |
|---|---|---|---|
variants | VariantCarouselVariant[] | Required | Two or more product images and coordinated color sets. |
brandName | string | "NOVA" | Small brand wordmark at the top. |
productName | string | "Everyday Bottle" | Large editorial product name. |
specifications | VariantCarouselSpecification[] | Generic bottle facts | Product values shown in the supporting line. |
capacities | string[] | ["18 oz", "24 oz", "32 oz"] | Capacity segment labels. |
initialCapacityIndex | number | 1 | Initially selected capacity. |
actionLabel | string | "Add to bag" | Purchase action text. |
priceLabel | string | "$38" | Formatted price text. |
carouselAccessibilityLabel | string | "Product color carousel" | Screen-reader name for the adjustable carousel. |
nextAccessibilityLabel | string | "Next color" | Screen-reader name for the tap-to-advance area. |
nextAccessibilityHint | string | "Shows the next color variant" | Screen-reader hint for advancing. |
onIndexChange | (index: number) => void | — | Runs after a variant transition settles. |
onGestureStart | () => void | — | Runs when dragging or selecting a color begins. |
onCapacityChange | (index: number) => void | — | Runs when a capacity is selected. |
onActionPress | () => void | — | Runs when the purchase action is pressed. |
springDamping | number | 26 | Transition spring damping. Values below the damping needed for ζ ≥ 0.8 are raised to that minimum. |
springStiffness | number | 260 | Transition spring stiffness. |
springMass | number | 1 | Transition spring mass. |
swipeDistanceThreshold | number | 0.16 | Required drag distance as a width fraction. |
swipeVelocityThreshold | number | 500 | Required horizontal fling velocity. |
productSizeRatio | number | 0.94 | Product size as a width fraction. |
productHorizontalOffset | number | 0 | Product horizontal offset as a width fraction. |
productVerticalOffset | number | 0.075 | Product top offset as a height fraction. |
purchaseBarColor | string | "#151713" | Purchase-button background color. |
purchaseTextColor | string | "#FFFFFF" | Purchase-button foreground color. |
brandFontFamily | string | System | Brand and seal font family. |
variantFontFamily | string | System | Variant-name font family. |
bodyFontFamily | string | System | Supporting copy and control font family. |
emphasisFontFamily | string | System | Selected values and CTA font family. |
titleFontFamily | string | System | Large product-name font family. |
style | StyleProp<ViewStyle> | — | Outer container style. |
testID | string | — | Outer container test identifier. |
The forwarded ref exposes goTo(index), next(), and prev().
Compatibility
- Expo SDK 58, React Native 0.88, Reanimated 4.7, and Worklets 0.13.
- Web: supported.
- iOS and Android: supported.
- Works in Expo Go because the native dependencies are included in the SDK 58 client.
Accessibility
The carousel exposes adjustable increment and decrement actions, every color and capacity is available by touch, and the CTA has a combined action-and-price label. Reduced Motion replaces perspective, parallax, and the circular sweep with a short crossfade while preserving every state change.
FAQ
- Does this React Native product carousel work in Expo Go?
- Yes. Gesture Handler, Reanimated, and Worklets are included in Expo SDK 58 and Expo SDK 57. Each published piece is reviewed on physical iPhone and Android devices with Expo Go before release.
- What can I customize for each product variant?
- Each variant supplies an image, name, and color set. The component also exposes product sizing, offsets, purchase labels, specifications, fonts, thresholds, and spring settings.
- Is there an alternative to the swipe gesture?
- Yes. A labeled next-variant button and the goTo, next, and prev ref methods use the same transition path. Reduce Motion removes spatial travel while content and colors still update.




