A React Native toy project demonstrating seamless drag-and-drop functionality between different scrollable containers using gestures and animations.
This project showcases how to implement independent drag-and-drop operations between two separate scroll views without interfering with the native scrolling behavior. It allows users to freely move items between containers while maintaining each view's original functionality.
- Independent Scroll Views: Drag operations don't interfere with scrolling behavior
- Cross-Container Drag & Drop: Move items freely between different scrollable containers
- Realistic Drag Animation: Items follow finger movement with spring animations
- Visual Feedback: Container highlighting when items are dragged over them
- Event-Based Architecture: Custom event bus for decoupled component communication
- HourBox: Example container that can receive and display items
- TodoList: Another container displaying items that can be dragged
- TodoBox: Individual draggable item
- MoveableTodoBox: Animated representation of an item being dragged
- Uses React Native Gesture Handler for advanced gesture recognition
- Implements Reanimated for smooth animations
- Custom event bus system for cross-component communication without prop drilling
- Zustand for lightweight state management
- Precise coordinate tracking for accurate drop zone detection
- Separation of concerns between scrolling and dragging gestures
- Long-press an item to start dragging
- The original item is hidden while a moveable clone follows your finger
- Scroll views maintain their normal behavior during drag operations
- When dragging over a different container, it highlights to indicate a valid drop zone
- Release to drop the item in the new container
- The source container removes the item while the target container adds it
This is a React Native project bootstrapped with @react-native-community/cli.
# Install dependencies
yarn install
# For iOS
yarn run ios
# For Android
yarn run androidThis project demonstrates several advanced React Native concepts:
- Simultaneous gesture handling without conflicts
- Independent component interactions via events
- Animation techniques for realistic drag feedback
- Coordinate system manipulation across different views
- State management with Zustand
