Popup Handler with Gesture Handler and Skia
Wednesday, July 26, 2023
Scan to try on your device
Need the app?
skia
gesture-handler
demos
popup-handler
An ongoing collection of React Native animations crafted with Reanimated, Gesture Handler, and Skia.
TypeScript
3.2k
296
A draggable popup component with position snapping and blurred background.
What's This About?
This component creates an interactive popup interface that can be dragged around the screen and snaps to different corners. It features a blurred background effect and supports various positioning options (top-left, top-right, bottom-left, bottom-right). The popup includes rotation animations based on its position and gesture handling for smooth dragging interactions.
Technical Implementation
The component uses:
Gesture handling
Position snapping
Blurred backgrounds
Corner rotation
Spring animations
Usage
// Basic usage
<PopupHandler />;
// Popup configuration
type Angle = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
// Gesture setup
const gesture = Gesture.Pan()
.onBegin(() => {
context.value = {
x: translateX.value,
y: translateY.value,
};
})
.onUpdate((event) => {
translateX.value = event.translationX + context.value.x;
translateY.value = event.translationY + context.value.y;
});
// With blurred background
<BlurredPopupProvider>
<TouchablePopupHandler>{/* Popup content */}</TouchablePopupHandler>
</BlurredPopupProvider>;
Unlock the beauty of React Native animations
Learn Reanimated, Gesture Handler & Skia with Reanimate.dev
Feedback on Popup Handler
Ideas, bugs, or anything that felt off: I read every message. For anything else, write to hello@reactiive.io.
Send feedback