Sign in to Reactiive

Use your Google or Apple account.
Signing in subscribes you to the newsletter: new content and the occasional promotion. Unsubscribe at any time.
Skip to content

Infinite Carousel with Reanimated and Gesture Handler

Wednesday, April 10, 2024
enzomanuelmangano
demos
infinite-carousel
An ongoing collection of React Native animations crafted with Reanimated, Gesture Handler, and Skia.
TypeScript
3.2k
296
A circular carousel component with infinite scrolling and dynamic theming.

What's This About?

This component creates an advanced carousel that provides seamless infinite scrolling in both directions. It features dynamic theme transitions, where the background color smoothly changes based on the active item. The carousel supports custom item rendering, precise snap behavior, and configurable interpolation for item animations. The implementation includes optimizations for smooth performance and a visually appealing interface with gradient backgrounds.

Technical Implementation

The component uses:
Circular scrolling logic
Dynamic theming
Custom interpolation
Gradient backgrounds
Item animations

Usage

// Basic usage with configuration <InfiniteCircularCarousel ref={carouselRef} data={ThemeData} listItemWidth={ListItemSize} centered snapEnabled onActiveIndexChanged={(index) => { // Handle index change }} interpolateConfig={{ inputRange: (index) => [ (index - 2) * ListItemSize, (index - 1) * ListItemSize, index * ListItemSize, (index + 1) * ListItemSize, (index + 2) * ListItemSize, ], outputRange: () => [-1, -1.5, 0, 1.5, 1], extrapolationType: Extrapolation.CLAMP, }} renderItem={({ item, index, progress }) => ( <ListItemCard item={item} index={index} progress={progress} onPress={() => { carouselRef.current?.scrollToIndex(index); }} /> )} />

Unlock the beauty of React Native animations

Learn Reanimated, Gesture Handler & Skia with Reanimate.dev

Feedback on Infinite Carousel

Ideas, bugs, or anything that felt off: I read every message. For anything else, write to hello@reactiive.io.
Send feedback