About this animation
A React Native animated button can confirm a copy action without adding a toast that competes with the surrounding interface. This compact control rotates its copy glyph into a check, flashes a success halo, sweeps light across the surface, and raises a short confirmation bubble. Use it beside code, invite links, account identifiers, addresses, or any value people frequently move to the clipboard. Reanimated coordinates the icon, halo, sweep, and bubble transitions, while Expo Linear Gradient gives the button material depth. The component deliberately does not import a clipboard package: your onCopy callback performs the actual product action. Configure controlled feedback, reset timing, size, labels, fonts, colors, and light or dark appearance.
When to use it
- Confirm copying code or an invite link.
- Add feedback beside a shareable identifier.
- Replace a transient toast with local confirmation.
- Control clipboard behavior in application code.
A copy button that draws a check and lifts a confirmation pill, with configurable confirmation text, font, surface color, and success color.
How it works
- A single shared progress value crossfades the two outlined copy rectangles into a check whose Skia path draws from start to finish.
- The same progress tints the button with the success accent, keeping the icon, surface, and confirmation state perfectly synchronized.
- A 1.4-second feedback timeline keeps the concise glass
Copiedpill 10 points clear of the button, then drifts it upward as it fades. - Press-in scales immediately to
0.94; release returns to1with a damped spring for a visual haptic response. - The component calls
onCopyinstead of owning a clipboard dependency, so consumers can useexpo-clipboard, a native bridge, or a simulated demo.
Why this one
Most copy buttons stop at an icon swap or a detached toast. This version keeps every response at the point of action: the two rectangles resolve into a genuinely drawn check, the material itself takes on the accent, and a compact glass label appears above the button without covering nearby content. The result confirms the action without shifting layout or making the user hunt for feedback.
Install
npx expo install @shopify/react-native-skia expo-blur expo-linear-gradient react-native-reanimated react-native-workletsUsage
import * as Clipboard from 'expo-clipboard';
import { CopyConfirmButton } from './CopyConfirmButton';
<CopyConfirmButton onCopy={() => Clipboard.setStringAsync(value)} />;
<CopyConfirmButton
size={56}
backgroundColor="#292735"
colorScheme="dark"
iconColor="#F4F4F8"
successColor="#765EFF"
copiedLabel="Copied"
resetMs={1400}
onCopy={() => Clipboard.setStringAsync(value)}
/>;Props
| Prop | Type | Default | Description |
|---|---|---|---|
blurTarget | React.RefObject<View | null> | undefined | Android backdrop ref. Wrap host content behind the component in BlurTargetView and pass its ref; keep the blur outside that target. |
copied | boolean | — | Controls the confirmation state externally. |
defaultCopied | boolean | false | Sets the initial uncontrolled state. |
onCopy | () => void | Required | Performs the application's copy operation. |
onChange | (copied: boolean) => void | — | Receives requested confirmation-state changes. |
resetMs | number | 1400 | Time before uncontrolled feedback resets. |
size | number | 52 | Square button size in points. |
backgroundColor | string | Scheme-aware | Resting button color. |
surfaceEndColor | string | Same as backgroundColor | Alternate resting surface color retained for API compatibility. |
iconColor | string | Scheme-aware | Resting copy icon color. |
successColor | string | '#6E56FF' | Success surface, dot, and glow color. |
copiedLabel | string | 'Copied' | Confirmation-pill text. |
fontFamily | string | System font | Confirmation-pill font family. |
colorScheme | 'light' | 'dark' | 'auto' | 'auto' | Surface and glass treatment. |
accessibilityLabel | string | 'Copy value' | Screen-reader action label. |
style | StyleProp<ViewStyle> | — | Button-container style. |
testID | string | — | Test identifier. |
The forwarded ref exposes copy() and reset() for guided demos and external controls.
Compatibility
Built for Expo SDK 58, React Native 0.88, Reanimated 4.7, and React Native Skia 2.14. Supports iOS, Android, and web. The included dependencies work in Expo Go for SDK 58.
Accessibility
The control exposes a labeled button and a selected confirmation state. The label updates to announce success. With Reduce Motion enabled, the icon and surface crossfade without travel, the glow and text shimmer are removed, and the confirmation pill remains stationary with a 10-point gap above the button.
For Android blur, wrap the backdrop in BlurTargetView from expo-blur, create its ref with useRef<View | null>(null), and pass that ref as blurTarget. The target must cover the blur bounds and exclude the blur itself. Without a target, the existing tint/background remains the fallback. dimezisBlurViewSdk31Plus enables blur on Android 12 and newer while keeping the fallback on older Android versions.
Customization notes
resetMs controls how long confirmation remains visible. Press and checkmark feedback use interruptible springs.
FAQ
- Does the animated copy button work in Expo Go?
- Yes. Expo Linear Gradient and Reanimated are available in Expo SDK 58 and Expo SDK 57. Each published piece is reviewed on physical iPhone and Android devices with Expo Go before release.
- Does the component write to the clipboard itself?
- No. It calls the required onCopy callback, so you choose the clipboard implementation. You can also control copied state or let the feedback reset after resetMs.
- What changes when Reduce Motion is enabled?
- The icons crossfade and the confirmation bubble appears in place without rotation or travel. The button retains its label and selected feedback state.
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.




