Gestures & Touch Interaction
Handle taps, swipes, drags, pinches and long presses with gesture systems that feel native and cooperate with scrolling.
Intermediate · about 5 hours · difficulty 3/5
Learn first: Animations & Transitions
Touch is the primary input on mobile, and users expect gestures to behave exactly like the system apps: swipe back, pull to refresh, swipe a row to delete, pinch to zoom.
Gesture building blocks
- Tap, double tap, long press: discrete gestures that fire once.
- Pan (drag), pinch, rotate: continuous gestures that report position, velocity and scale over time.
- Fling: a pan that ends with velocity; use that velocity to continue motion with a decay or spring animation.
Composing gestures
The hard part is deciding which gesture wins. A horizontal swipe on a list row competes with the vertical scroll of the list and the edge swipe of the navigator. Gesture systems let you declare simultaneous, exclusive or required-to-fail relationships and activation thresholds (for example, only start a horizontal pan after 10 px of horizontal movement).
Tools by stack
- React Native: react-native-gesture-handler with the
Gesture.Pan(),Gesture.Pinch()API andGestureDetector, paired with Reanimated so updates run on the UI thread.Pressablecovers simple presses. - Flutter:
GestureDetector,Dismissible,DraggableandInteractiveViewerfor zoom and pan. - Compose:
Modifier.clickable,draggable,transformableandpointerInput { detectDragGestures { } }. - SwiftUI:
DragGesture,MagnifyGesture,LongPressGesturecombined with.simultaneously(with:)or.exclusively(before:).
Feel details
- Touch targets of at least 44 pt (iOS) or 48 dp (Android).
- Visual feedback within 100 ms of a touch (ripple, highlight, scale).
- Light haptics on meaningful moments like a successful swipe action.
- Always offer a non-gesture alternative (a button or menu) for accessibility.
Good enough to move on: you can build a swipe-to-delete row that does not fight the list scroll and snaps back naturally when released early.
Key concepts
- Discrete vs continuous gestures
- Gesture Handler and GestureDetector: React Native
- Gesture conflicts with scrolling
- Velocity and fling physics
- Pinch to zoom
- Touch target sizes
- Haptic feedback
Mini project
Build an inbox list with swipe-left to archive, swipe-right to mark read, long press for a context menu, and a pinch-to-zoom image viewer on the detail screen.
Check yourself
A horizontal swipe on your list row keeps triggering the list scroll instead. What gesture configuration would you change?
Free resources
- React Native Gesture Handler (Software Mansion)
- Flutter: Taps, drags and other gestures (Flutter)
- Compose: Gestures (Android Developers)