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

Animated Stacked FlatList made with Reanimated

Wednesday, May 1, 2024
enzomanuelmangano
demos
stacked-list
An ongoing collection of React Native animations crafted with Reanimated, Gesture Handler, and Skia.
TypeScript
3.2k
296
A scrollable list with stacked item animations and scaling effects.

What's This About?

This component creates a sophisticated scrollable list where items stack and scale based on their position in the viewport. It features smooth animations for item transitions, with items scaling and transforming as they move through the list. The implementation includes precise interpolation for visibility and transformation calculations, making it perfect for dynamic list interfaces with engaging visual effects.

Technical Implementation

The component uses:
Scroll handling
Position interpolation
Scale animations
Visibility calculations
Transform effects

Usage

// Basic usage <StackedList />; // List item configuration const ListConfig = { itemHeight: 100, margin: 10, marginTop: 70, offset: 80, }; // List item component const ListItem = ({ index, scrollOffset, }: { index: number; scrollOffset: SharedValue<number>; }) => { const baseTranslateY = index * (ListConfig.itemHeight + ListConfig.margin); // Visibility calculation const visibleAmount = useDerivedValue(() => { const distanceFromTop = scrollOffset.value + (ScreenHeight - ListConfig.marginTop - ListConfig.offset) - baseTranslateY; return interpolate( distanceFromTop, [0, ListConfig.itemHeight + ListConfig.margin], [0, ListConfig.itemHeight + ListConfig.margin], Extrapolation.EXTEND ); }, []); // Scale animation const scale = useDerivedValue(() => { return interpolate( visibleAmount.value, [0, ListConfig.itemHeight + ListConfig.margin], [0.6, 1], Extrapolation.CLAMP ); }, []); };

Unlock the beauty of React Native animations

Learn Reanimated, Gesture Handler & Skia with Reanimate.dev

Feedback on Stacked List

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