Reorderable list
Variable-height reordering for bounded collections; parent owns scrolling, without edge autoscroll.
npx @swipeui/cli add reorderable-listWhen to use it
- Letting people reorder a short list, such as playlist tracks, priorities or home screen sections.
- Rows of different heights that need to be dragged into place.
- Reordering that must also work without dragging.
When not to use it
- Long lists that need virtualisation or edge autoscroll; it's built for bounded lists.
- Sorting by a field. Offer a sort menu.
- Kanban boards across columns.
Installation
Run this from your app's root. If SwipeUI isn't set up yet, run npx @swipeui/cli init first; it sets up Uniwind, the theme tokens and the cn helper.
npx @swipeui/cli add reorderable-list- Adds
components/swipeui/ui/reorderable-list.tsx,components/swipeui/ui/use-reorderable-row.tsand 6 shared helpers. - Installs react-native-gesture-handler, react-native-reanimated, react-native-worklets, uniwind, clsx, tailwind-merge, class-variance-authority, expo-haptics. In Expo apps it uses
npx expo installso versions match your SDK.
Usage
import { ReorderableList } from '@/components/swipeui/ui/reorderable-list';
<ReorderableList items={tasks} onOrderChange={setOrder} />;API reference
| Prop | Type | Default | Description |
|---|---|---|---|
onHandlePress? | | — | Optional tap alternative on the drag handle; the caller can open a position chooser. |
dragActivation? | | | Where dragging begins. |
showMoveControls? | | | Keep single-tap movement alternatives visible. |
liftFeedback? | | | Scale the lifted row slightly. |
animateReorder? | | | Animate neighbouring rows and accepted order changes. |
longPressDelay? | | | Hold delay before dragging, in milliseconds. |
messages? | | — | Text overrides; movement entries override legacy moveLabels. |
items | | — | Ordered rows; the caller must accept order changes to update the display. |
onOrderChange | | — | Reports a complete ordered identifier list after an accepted movement. |
disabled? | | — | Disable dragging and movement actions. |
moveLabels? | | | Localized up/down labels. |
haptics? | | — | Drop feedback. |
motion? | | — | Shared drag/reflow motion. |
className? | | — | Root classes. |
style? | | — | Root layout escape hatch. |
testID? | | — | Root identifier. |
Composition and behavior
- items each have an id, label and content.
- onOrderChange receives the new id order.
- moveLabels translate the move buttons.
Behavior and gestures
- Press and hold a row for a quarter of a second, then drag it; other rows move aside.
- Let go to drop it; a light tick confirms the new order.
- Each row also has Move up and Move down buttons.
- Your app must accept the new order for the list to update.
Accessibility
- Each row offers Move up and Move down as buttons and accessibility actions, named like "Move up: Track 3".
- Dragging is never required.
- Labels can be translated with moveLabels.
Motion
- Uses the
listandpressmotion roles, so it follows your app's feel. Passmotionto tune this one instance. - Dragged rows follow your finger; others shift with the list spring.
- Reduce Motion makes shifts instant.
Performance
- Rows are measured once; drag runs on the UI thread.
- The parent owns scrolling; there's no virtualisation.
Notes for AI
- Update items from onOrderChange; it returns the full ordered id list.
Compatibility
| Runs on | Supported |
|---|---|
| Expo SDK 57 | Yes |
| Expo SDK 58 | Yes |
| React Native CLI (with Expo modules) | Yes |
| Expo Go | Yes |
| iOS | Yes |
| Android | Yes |
This table describes API support and static bundle checks. Native runtime, device accessibility and bare Uniwind compatibility remain pending.