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
- A long-press gesture begins a linear shared-value animation on contact.
- Releasing before the duration springs progress back to zero.
- 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.
- The bar scales from its left edge; the ring reveals evenly spaced perimeter segments.
- 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-workletsUsage
<HoldToConfirmButton onConfirm={() => submit()} />
<HoldToConfirmButton
variant="ring"
holdMs={900}
height={80}
progressColor="#5B4CF0"
colorScheme="light"
/>Props
| Prop | Type | Default | Description |
|---|---|---|---|
confirmed | boolean | undefined | Controlled completion state. |
defaultConfirmed | boolean | false | Initial completion state when uncontrolled. |
onChange | (confirmed: boolean) => void | undefined | Called when the completion state changes. |
onConfirm | () => void | undefined | Called once a hold completes. |
holdMs | number | 1200 | Hold duration in milliseconds. |
variant | 'bar' | 'ring' | 'bar' | Progress presentation. |
label | string | 'Hold to confirm' | Idle instruction. |
doneLabel | string | 'Confirmed' | Completion text. |
width | number | 240 | Button width for the bar variant. |
height | number | 56 | Button height, and ring diameter. |
backgroundColor | string | undefined | Base button color. Defaults to a scheme-aware near-black. |
backgroundEndColor | string | undefined | Nearby end color for the material gradient. |
progressColor | string | '#6D5DFB' | Progress color. |
textColor | string | '#FFFFFF' | Text and check color. |
fontFamily | string | undefined | Font family for the label. |
colorScheme | 'light' | 'dark' | 'auto' | 'auto' | Color treatment, or the device setting when set to auto. |
accessibilityLabel | string | label | Screen-reader label. |
style | StyleProp<ViewStyle> | undefined | Style for the outer container. |
testID | string | undefined | Test identifier for the interactive control. |
duration | number | 520 | Post-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.




