> For AI agents: the complete documentation index is available at https://react-native-swipe-deck.pages.dev/llms.txt, the full documentation bundle is available at https://react-native-swipe-deck.pages.dev/llms-full.txt.

# Programmatic Actions

Programmatic actions come from `useDeckActions()`. Use them for buttons,
external controls, or any app logic that should dismiss the active card.

```tsx
function LikeButton() {
  const { swipeRight, swipeUp } = ProfileDeck.useDeckActions();

  return (
    <>
      <Pressable onPress={swipeRight}>
        <Text>Like</Text>
      </Pressable>
      <Pressable onPress={swipeUp}>
        <Text>Up</Text>
      </Pressable>
    </>
  );
}
```

`swipeUp()` is accepted only when the Root explicitly includes `'up'` in
`allowedDirections`. Gesture up also requires free drag mode; programmatic
`swipeUp()` is still available when drag mode is horizontal.

## Action Motion

`motion` controls manual drag feel. `actionMotion` controls only programmatic
actions such as `swipeLeft()`, `swipeRight()`, and `swipeUp()`.

```tsx
import {
  createSwipeDeck,
  SwipeDeckActionMotion,
  SwipeDeckMotion,
} from '@react-native-motion-kit/swipe-deck';

const ProfileDeck = createSwipeDeck<Profile>({
  motion: SwipeDeckMotion.tinder(),
  actionMotion: SwipeDeckActionMotion.springboard({
    anticipationDistance: ({ width }) => width * 0.04,
    anticipationDuration: 80,
    dismissDuration: 320,
  }),
});
```

## Recipes

### `SwipeDeckActionMotion.direct(options?)`

Dismisses immediately toward the action direction. Omitted values reuse the
deck's resolved dismiss duration, easing, and offscreen multiplier.

```tsx
actions.swipeLeft(
  SwipeDeckActionMotion.direct({
    duration: 180,
  }),
);
```

### `SwipeDeckActionMotion.springboard(options?)`

Moves a little in the opposite direction first, then dismisses offscreen. During
anticipation, swipe progress and live direction stay neutral so opposite-side
overlays do not flash.

```tsx
const actionMotion = SwipeDeckActionMotion.springboard({
  anticipationDistance: 40,
  anticipationDuration: 160,
  dismissDuration: 500,
});
```

## Precedence

`actionMotion` is replacement-based, not deep-merged:

1. factory `actionMotion` from `createSwipeDeck({ actionMotion })`
2. `Root actionMotion`, replacing the factory default for that Root
3. per-call recipe passed to `swipeLeft(recipe)`, `swipeRight(recipe)`, or `swipeUp(recipe)`

Actions are callback-safe. If a React Native press event is passed to
`swipeRight`, `swipeLeft`, or `swipeUp`, the event argument is ignored and the
configured action motion is used.
