Drag Handles
By default, touching anywhere on a DraxView starts a drag. With drag handles, only the handle area initiates a drag — the rest of the view can scroll or receive taps normally.
Basic Usage
import { DraxView, DraxHandle } from 'react-native-drax';
<DraxView dragHandle style={styles.row}>
<Text style={styles.content}>Item content — taps and scrolls work here</Text>
<DraxHandle style={styles.grip}>
<Text>☰</Text>
</DraxHandle>
</DraxView>
Two things are needed:
- Set
dragHandleon theDraxView— this tells it NOT to attach the gesture directly - Place a
<DraxHandle>inside — this is where the gesture is attached
With Sortable Items
<SortableItem sortable={sortable} index={index} dragHandle>
<View style={styles.row}>
<DraxHandle style={styles.grip}>
<GripIcon />
</DraxHandle>
<Text style={styles.label}>{item.title}</Text>
</View>
</SortableItem>
How It Works
- When
dragHandleistrue, theDraxViewskips wrapping its children in aGestureDetector - Instead, it provides the gesture via
DraxHandleContext DraxHandleconsumes that context and wraps its own children withGestureDetector- Only touches starting on the
DraxHandlearea activate the drag gesture
tip
In the hover layer (floating copy), DraxHandle renders as a plain view since the gesture isn't needed there.
Next Steps
- Composable API — Using handles with SortableItem
- API: DraxHandle — Full component reference