Skip to content
Native Animation
Decision Swipe Deck animation preview

This preview uses fictional demo content. See the props below for the customization options available in this component.

npx nativeanimation add decision-swipe-deck

Decision Swipe Deck

React Native Swipe Cards Deck with Undo

A swipe decision deck with reactive stamps and undo, with configurable items, card content, colors, and decision labels.

$9 for this animation

Add to your project

Copy the component and its assets into your app with the Native Animation CLI, or paste the agent prompt into Claude Code, Codex or Cursor once the MCP server is connected.

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

  1. The component measures its container and sizes the cards, fan, stamps, and controls proportionally.
  2. One horizontal shared value drives the active card, decision tint, stamp reveal, and the progress that advances every card behind it.
  3. Release distance and horizontal velocity jointly decide whether the card returns or exits; the exit spring preserves the gesture velocity.
  4. The initial touch height reverses the rotation direction, so the card turns naturally around the point where it was grabbed.
  5. 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-worklets

Usage

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

PropTypeDefaultDescription
itemsT[]RequiredItems shown in deck order.
renderCard(item: T, index: number) => ReactNodeRequiredRenders one card. The index is its position in items.
keyExtractor(item: T) => stringRequiredReturns a stable key for an item.
yesLabelstring'YES'Positive-decision stamp.
noLabelstring'NOPE'Negative-decision stamp.
thresholdnumber0.28Horizontal release threshold as a fraction of container width.
visibleCountnumber3Maximum number of cards mounted at once.
onSwipe(item: T, direction: 'left' | 'right') => voidundefinedCalled after a card exits.
onEmpty() => voidundefinedCalled when the last card exits.
showButtonsbooleantrueShows accessible No, Undo, and Yes buttons.
fontFamilystringundefinedFont family used by the decision stamps.
styleStyleProp<ViewStyle>undefinedOptional style for the outer container.
testIDstringundefinedTest identifier applied to the outer container.
colorsreadonly [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.