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

Selectable Grid List with Reanimated and Gesture Handler

Wednesday, June 28, 2023
enzomanuelmangano
demos
selectable-grid-list
An ongoing collection of React Native animations crafted with Reanimated, Gesture Handler, and Skia.
TypeScript
3.2k
296
A grid list component with multi-select capabilities and animated feedback.

What's This About?

This component creates an interactive grid list where items can be selected and deselected with animated transitions. It features a configurable grid layout, a floating action button that responds to selection state, and smooth animations for selection feedback. The implementation includes safe area handling and dynamic item sizing based on screen width, making it suitable for gallery or file selection interfaces.

Technical Implementation

The component uses:
Grid layout management
Multi-selection handling
Animated transitions
Floating action button
Safe area awareness

Usage

// Grid configuration const GridConfig = { itemsPerRow: 4, internalPadding: 4, }; // Basic usage <SelectableGridList data={items} numColumns={GridConfig.itemsPerRow} itemSize={itemSize} onSelectionChange={(indexes) => { selectedIndexesAmount.value = indexes.length; }} renderItem={({ index, activeIndexes }) => ( <SelectableListItem index={index} internalPadding={GridConfig.internalPadding} containerWidth={itemSize} containerHeight={itemSize} activeIndexes={activeIndexes} /> )} />; // Reset selection gridListRef.current?.reset(); // Floating button animation const rFloatingButtonStyle = useAnimatedStyle(() => { return { transform: [ { translateY: withSpring(selectedIndexesAmount.value === 0 ? 150 : 0), }, ], }; });

Unlock the beauty of React Native animations

Learn Reanimated, Gesture Handler & Skia with Reanimate.dev

Feedback on Selectable Grid List

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