FreeMIT License

Slide to Confirm — Swipe-to-Pay Button for React Native & Expo

A slide-to-confirm button for React Native: drag to pay, transfer or unlock, with a spinner while your action runs, a done state and a retryable error. Reanimated 4, Gesture Handler, haptics, light and dark, works with touch and mouse.

by UpFork, built by Ramin ValadanMobile componentUpdated 14 Oct 2026

Watch0
Preview of Slide to Confirm — Swipe-to-Pay Button for React Native & Expo

Code

4 files · 5 packages

import { useEffect } from 'react';
import Animated, {
  Easing,
  cancelAnimation,
  useAnimatedStyle,
  useSharedValue,
  withRepeat,
  withTiming,
} from 'react-native-reanimated';
import Svg, { Circle, Path } from 'react-native-svg';

type IconProps = { size: number; color: string };

export function ArrowIcon({ size, color }: IconProps) {
  return (
    <Svg width={size} height={size} viewBox="0 0 24 24" fill="none">
      <Path
        d="M5 12h13M13 6l6 6-6 6"
        stroke={color}
        strokeWidth={2.2}
        strokeLinecap="round"
        strokeLinejoin="round"
      />
    </Svg>
  );
}

export function CheckIcon({ size, color }: IconProps) {
  return (
    <Svg width={size} height={size} viewBox="0 0 24 24" fill="none">
      <Path
        d="M5 12.5l4.5 4.5L19 7.5"
        stroke={color}
        strokeWidth={2.4}
        strokeLinecap="round"
        strokeLinejoin="round"
      />
    </Svg>
  );
}

export function CrossIcon({ size, color }: IconProps) {
  return (
    <Svg width={size} height={size} viewBox="0 0 24 24" fill="none">
      <Path d="M7 7l10 10M17 7L7 17" stroke={color} strokeWidth={2.4} strokeLinecap="round" />
    </Svg>
  );
}

/** A quarter-open ring that turns while the confirmation is under way. */
export function Spinner({ size, color }: IconProps) {
  const turn = useSharedValue(0);

  useEffect(() => {
    turn.value = withRepeat(withTiming(1, { duration: 850, easing: Easing.linear }), -1, false);
    return () => cancelAnimation(turn);
  }, [turn]);

  const style = useAnimatedStyle(() => ({ transform: [{ rotate: `${turn.value * 360}deg` }] }));

  return (
    <Animated.View style={[{ width: size, height: size }, style]}>
      <Svg width={size} height={size} viewBox="0 0 24 24" fill="none">
        <Circle cx={12} cy={12} r={8.5} stroke={color} strokeOpacity={0.25} strokeWidth={2.4} />
        <Path d="M12 3.5a8.5 8.5 0 0 1 8.5 8.5" stroke={color} strokeWidth={2.4} strokeLinecap="round" />
      </Svg>
    </Animated.View>
  );
}
4 files5 packages

About

Some actions shouldn't happen on a stray tap: paying, sending money, unlocking, deleting an account. Slide to Confirm asks for a deliberate swipe, then keeps the person informed: a spinner while your code runs, a calm "Paid" when it's done, and a clear error they can retry when it isn't.

  • Async built in. Return a promise from onConfirm: the thumb waits at the end with a spinner, then shows your done label, or springs back with your error label.
  • Feels physical. 1:1 drag, a spring back if you let go early, a fling that finishes the slide, a haptic tick at the point of no return and a success or error buzz.
  • Touch and mouse. Built on Gesture Handler, so it works with a finger on phones and with the mouse on the web; a tap nudges the thumb to show it slides.
  • Accessible. Screen readers get a button with an activate action, and reduced motion stills the chevrons.
  • Yours to style. Any tint, light and dark themes, any height.

Reviews and bugs

0 reviews · 0 bugs

Ship it0With fixes0Skip0· 0 reviews

0 bugs0 open0 fixed

Members who have it review it and report its bugs. Sign in

No reviews or bugs yet.

Installation

React Native · Expo SDK 57

Built withExpo HapticsGesture HandlerReanimatedSVG

  1. 01

    Copy the files into your app

    • components/slide-to-confirm/icons.tsx
    • components/slide-to-confirm/index.ts
    • components/slide-to-confirm/slide-to-confirm.tsx
    • lib/use-scheme.ts
    • demos/ (2 screens showing it in use)

    At your app’s root, the folders side by side as they are: the files import each other by relative paths.

  2. 02

    Install the packages with Expo

    npx expo install expo-haptics react-native-gesture-handler react-native-reanimated react-native-svg react-native-worklets
  3. 03

    See it in your app

    Make demos/checkout.tsx your app’s App.tsx, inside the GestureHandlerRootView that Gesture Handler needs at its root:

    import { GestureHandlerRootView } from 'react-native-gesture-handler';
    
    import Checkout from './demos/checkout';
    
    export default function App() {
      return (
        <GestureHandlerRootView style={{ flex: 1 }}>
          <Checkout scheme="light" />
        </GestureHandlerRootView>
      );
    }
    

UpFork installs every revision just so into a fresh Expo app (SDK 57), type-checks it and builds it for the web before it goes on sale. An AI assistant can do it for you through UpFork’s MCP server: Install mobile components has both ways.

Before you buy

Everything you need to know

How this mobile component gets from the preview into your project, and what buyers ask most.

How to use it

From the preview to your project

  1. 01

    Try it in the preview

    Switch between light and dark, and resize it to phone and tablet widths, before you decide.

  2. 02

    Get it

    Free products are yours with a free account. Paid ones settle in USDT on TRON, sent straight to the wallet on your order.

  3. 03

    Install it

    Components go into your project with one shadcn command, dependencies included. Everything else downloads with a checksum.

  4. 04

    Make it yours

    It's your code now: rename it, restyle it and wire in your real data.

  5. 05

    Or hand it to your AI

    Copy the prompt and let your coding assistant place it in your project, following your conventions.

Building with an AI assistant?

Copy a ready-made prompt with the code, its dependencies and a demo, and your assistant can put it in place for you.

Copy AI prompt

Selling your own work?

Get approved once, then publish components, templates and mobile components, paid in USDT straight to your own wallet.