Skip to content
Native Animation
Hold to Confirm Button animation preview

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

npx nativeanimation add hold-to-confirm-button
ButtonMicro

Hold to Confirm Button

React Native Hold to Confirm Button

A hold-to-confirm control with animated progress and a success finish, with configurable labels, width, progress color, and font.

Free
Get it free with your email

No password and no card: we email you a sign-in link, then the full source is yours.

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

A React Native long press button adds deliberate friction before an action that should not happen by accident. This hold-to-confirm control fills a bar or traces a segmented ring while contact continues, springs back when released early, and finishes with a drawn check, glow, and light sweep. Use it for destructive actions, publishing, sending, recording, or high-impact settings where an ordinary tap is too easy to trigger. Gesture Handler recognizes the hold, Reanimated keeps progress and feedback on the UI thread, and Expo Linear Gradient gives the surface depth in light or dark themes. Configure duration, presentation, size, labels, colors, controlled state, and callbacks without changing the interaction model.

When to use it

  • Confirm a destructive or irreversible action.
  • Prevent accidental publishing or sending.
  • Add deliberate friction to a sensitive control.
  • Show continuous progress toward confirmation.

A hold-to-confirm control with animated progress and a success finish, with configurable labels, width, progress color, and font.

How it works

  1. A long-press gesture begins a linear shared-value animation on contact.
  2. Releasing before the duration springs progress back to zero.
  3. Completion swaps the label, draws a proportioned round-cap check from a fixed vertex, and sends a short glow and light sweep across the surface.
  4. The bar scales from its left edge; the ring reveals evenly spaced perimeter segments.
  5. Scheme-aware close-tone gradients, a light edge, and layered shadow give both variants material depth.

Install

npx expo install expo-linear-gradient react-native-gesture-handler react-native-reanimated react-native-worklets

Usage

<HoldToConfirmButton onConfirm={() => submit()} />

<HoldToConfirmButton
  variant="ring"
  holdMs={900}
  height={80}
  progressColor="#5B4CF0"
  colorScheme="light"
/>

Props

PropTypeDefaultDescription
confirmedbooleanundefinedControlled completion state.
defaultConfirmedbooleanfalseInitial completion state when uncontrolled.
onChange(confirmed: boolean) => voidundefinedCalled when the completion state changes.
onConfirm() => voidundefinedCalled once a hold completes.
holdMsnumber1200Hold duration in milliseconds.
variant'bar' | 'ring''bar'Progress presentation.
labelstring'Hold to confirm'Idle instruction.
doneLabelstring'Confirmed'Completion text.
widthnumber240Button width for the bar variant.
heightnumber56Button height, and ring diameter.
backgroundColorstringundefinedBase button color. Defaults to a scheme-aware near-black.
backgroundEndColorstringundefinedNearby end color for the material gradient.
progressColorstring'#6D5DFB'Progress color.
textColorstring'#FFFFFF'Text and check color.
fontFamilystringundefinedFont family for the label.
colorScheme'light' | 'dark' | 'auto''auto'Color treatment, or the device setting when set to auto.
accessibilityLabelstringlabelScreen-reader label.
styleStyleProp<ViewStyle>undefinedStyle for the outer container.
testIDstringundefinedTest identifier for the interactive control.
durationnumber520Post-confirmation success wave duration in milliseconds; holdMs is separate. Spring physics and reduced-motion timing are unchanged.

Compatibility

Expo SDK 58, React Native 0.88, Reanimated 4.7, Gesture Handler 3.3, and Worklets 0.13. Supports iOS, Android, and web. Works in Expo Go.

Accessibility

The control is a labeled button. A screen-reader activation confirms immediately, avoiding a gesture that cannot be reliably held. Reduced Motion keeps the timed affordance but removes the spring and check travel.

FAQ

Does the long press button work in Expo Go?
Yes. Its Expo SDK 58 and Expo SDK 57 dependencies are available in Expo Go. Each published piece is reviewed on physical iPhone and Android devices with Expo Go before release.
Can I change the hold duration and progress style?
Yes. Configure holdMs, choose the bar or ring variant, set dimensions and colors, replace labels, and use controlled or uncontrolled completion state.
How can a screen-reader user confirm the action?
A screen-reader activation confirms immediately instead of requiring a hold gesture. Reduce Motion keeps the timed affordance but removes spring and check travel.

Source code

Free with an account

Sign in with your email to read the full source here, or install it in one command with the CLI.

Get it free