Gooey Delete Button with React Native Skia
Tuesday, October 8, 2024
Try the live demo
Scan to try on your device
Need the app?
demos
delete-button
An ongoing collection of React Native animations crafted with Reanimated, Gesture Handler, and Skia.
TypeScript
3.2k
296
Delete button component with fluid animations and a gooey effect. Features a two-state interaction pattern with smooth transitions and confirmations.
What's This About?
This component creates an interactive delete button that expands to reveal a confirmation state. It features:
Smooth expansion animation with a gooey effect
Close button that appears during confirmation
Dynamic text transitions between states
Gesture-based interactions
Customizable dimensions and text
Technical Implementation
The component leverages Skia for high-performance rendering and implements:
Gooey effect using Skia layer blending
Complex gesture handling with Skia touch events
Multiple coordinated animations:
Button expansion/contraction
Color transitions
Text opacity and position
Close button reveal
Custom font handling
Usage
type DeleteButtonProps = {
onConfirmDeletion: () => void;
height: number;
width: number;
initialText?: string;
confirmText?: string;
additionalWidth: number;
closeOnConfirm?: boolean;
};
// Basic usage
<DeleteButton
height={50}
width={150}
additionalWidth={80}
onConfirmDeletion={() => {
console.log('Confirmed deletion');
}}
/>
// Customized version
<DeleteButton
height={50}
width={150}
additionalWidth={80}
initialText="Remove"
confirmText="Sure?"
closeOnConfirm={true}
onConfirmDeletion={() => {
handleDeletion();
}}
/>
Unlock the beauty of React Native animations
Learn Reanimated, Gesture Handler & Skia with Reanimate.dev
Feedback on Delete Button
Ideas, bugs, or anything that felt off: I read every message. For anything else, write to hello@reactiive.io.
Send feedback