About this animation
React Native swipe cards work best when the next decision is already visible and every visual cue follows the finger. This deck uses one horizontal Reanimated shared value to drive card movement, grip-aware rotation, decision tint, stamp reveal, and the stacked cards underneath. Gesture Handler combines release distance with velocity, then preserves that velocity in an interruptible exit spring. Use it for preference setup, triage, matching, shortlists, or review queues where a binary choice should feel direct. The component accepts generic item data and a renderCard function, keeps a decision history for undo, exposes imperative swipe controls, and includes labeled No, Undo, and Yes buttons as a complete alternative to dragging.
When to use it
- Sort items into keep and pass queues.
- Collect preferences during onboarding.
- Review candidates, events, or saved content.
- Offer a fast decision flow with undo.
Related guides
A swipe decision deck with reactive stamps and undo, with configurable items, card content, colors, and decision labels.
How it works
- The component measures its container and sizes the cards, fan, stamps, and controls proportionally.
- One horizontal shared value drives the active card, decision tint, stamp reveal, and the progress that advances every card behind it.
- Release distance and horizontal velocity jointly decide whether the card returns or exits; the exit spring preserves the gesture velocity.
- The initial touch height reverses the rotation direction, so the card turns naturally around the point where it was grabbed.
- Completed decisions are kept in a small history stack.
undo()remounts the previous card on the side where it exited and springs it home.
Why this one
Most swipe decks stop at a card flying left or right. This version communicates the decision while the finger moves, prepares the next card continuously, accounts for throw velocity and grip position, and includes both undo and a complete touch-accessible alternative to the gesture. Its controls use one Lucide-family icon system inside layered glass circles, with spring press feedback and soft direction-aware halos that follow the card.
Icons: Lucide/Feather (ISC).
Install
npx expo install @expo/vector-icons expo-blur react-native-gesture-handler react-native-reanimated react-native-workletsUsage
import DecisionSwipeDeck from './DecisionSwipeDeck';
export function Choices() {
return (
<DecisionSwipeDeck
items={options}
keyExtractor={(item) => item.id}
renderCard={(item) => <OptionCard option={item} />}
onSwipe={(item, direction) => saveDecision(item.id, direction)}
/>
);
}Customize labels, the threshold, visible stack, and imperative controls:
import { useRef } from 'react';
import DecisionSwipeDeck, { type DecisionSwipeDeckRef } from './DecisionSwipeDeck';
export function EventPicker() {
const deckRef = useRef<DecisionSwipeDeckRef>(null);
return (
<DecisionSwipeDeck
ref={deckRef}
items={events}
keyExtractor={(event) => event.id}
renderCard={(event) => <EventPoster event={event} />}
yesLabel="SAVE"
noLabel="PASS"
threshold={0.24}
visibleCount={4}
fontFamily="YourSansFont"
onEmpty={() => showSummary()}
/>
);
}The forwarded ref exposes swipe('left' | 'right') and undo().
Props
| Prop | Type | Default | Description |
|---|---|---|---|
items | T[] | Required | Items shown in deck order. |
renderCard | (item: T, index: number) => ReactNode | Required | Renders one card. The index is its position in items. |
keyExtractor | (item: T) => string | Required | Returns a stable key for an item. |
yesLabel | string | 'YES' | Positive-decision stamp. |
noLabel | string | 'NOPE' | Negative-decision stamp. |
threshold | number | 0.28 | Horizontal release threshold as a fraction of container width. |
visibleCount | number | 3 | Maximum number of cards mounted at once. |
onSwipe | (item: T, direction: 'left' | 'right') => void | undefined | Called after a card exits. |
onEmpty | () => void | undefined | Called when the last card exits. |
showButtons | boolean | true | Shows accessible No, Undo, and Yes buttons. |
fontFamily | string | undefined | Font family used by the decision stamps. |
style | StyleProp<ViewStyle> | undefined | Optional style for the outer container. |
testID | string | undefined | Test identifier applied to the outer container. |
colors | readonly [string, string, string] | ['#E05D5D', '#8B7355', '#24A66A'] | Colors for the negative, undo, and positive action icons. |
Compatibility
- Expo SDK 58
- React Native 0.88
- Reanimated 4.7 and Worklets 0.13
- iOS: supported
- Android: supported
- Web: supported
- Works in Expo Go because its native dependencies are included in the SDK
Accessibility
The three circular controls are labeled buttons and provide a full alternative to dragging. The active card exposes yes, no, and undo accessibility actions even when showButtons is false. Decisions and undo follow stable IDs from keyExtractor when items are reordered or replaced. When reduced motion is enabled, decisions and undo update immediately without flying or spring movement.
Customization notes
Movement follows gestures, scroll position, or interruptible spring physics. A global duration is not exposed; reduced-motion fades retain their short fixed timing.
FAQ
- Do React Native swipe cards 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.
- Can I customize the cards and swipe threshold?
- Yes. Supply any item type and renderCard output, then configure labels, threshold, visibleCount, fontFamily, callbacks, and the imperative swipe and undo methods.
- Is dragging the only way to use the deck?
- No. Labeled decision buttons and adjustable semantics provide accessible alternatives. Reduce Motion commits decisions and undo without off-screen travel or spring movement.




