Sign in to Reactiive

Use your Google or Apple account.
Signing in subscribes you to the newsletter: new content and the occasional promotion. Unsubscribe at any time.
Skip to content

Family Action Tray with Reanimated and Gesture Handler

Wednesday, November 15, 2023
enzomanuelmangano
demos
action-tray
An ongoing collection of React Native animations crafted with Reanimated, Gesture Handler, and Skia.
TypeScript
3.2k
296
A highly interactive and customizable bottom sheet component for React Native that provides a smooth sliding tray interface with gesture controls.

What's This About?

The Action Tray creates a bottom sheet interface that:
Slides up from the bottom of the screen
Responds to touch gestures for opening and closing
Features smooth spring animations
Includes a backdrop overlay
Supports dynamic content height changes

How It Works

The component is built with two main parts:
ActionTray: The core component that:
Handles gesture interactions
Manages the sliding animation
Controls the tray's position
Provides imperative methods for programmatic control
Main Interface: A demonstration that showcases:
Multiple content states
Dynamic height adjustments
Smooth transitions between states
A toggle button with rotation animation

Technical Details

Built with react-native-reanimated for fluid animations
Uses react-native-gesture-handler for touch interactions
Implements worklet functions for native-thread performance
Features spring animations for natural movement
Supports custom styling and height configurations

Implementation Notes

Uses shared values for smooth state management
Implements gesture clamping for controlled movements
Provides ref-based control methods (open/close)
Supports custom maximum height configuration
Includes a backdrop component with fade animations

Usage

// Create a ref to control the tray const ref = useRef<ActionTrayRef>(null); // Open the tray ref.current?.open(); // Close the tray ref.current?.close(); // Check if tray is active const isActive = ref.current?.isActive();

Unlock the beauty of React Native animations

Learn Reanimated, Gesture Handler & Skia with Reanimate.dev

Feedback on Action Tray

Ideas, bugs, or anything that felt off: I read every message. For anything else, write to hello@reactiive.io.
Send feedback