# Migrate from react-native-draggable-flatlist

> Switch from react-native-draggable-flatlist to Patine UI's SortableList: drag to reorder with no Reanimated or gesture handler, long press or a handle, auto-scroll, keyboard reordering on the web and screen-reader move actions.

# Migrate from `react-native-draggable-flatlist`

```diff
- import DraggableFlatList, { ScaleDecorator } from 'react-native-draggable-flatlist';
+ import { SortableHandle, SortableList } from 'patine-ui';

- <DraggableFlatList
-   data={data}
-   keyExtractor={(item) => item.id}
-   onDragEnd={({ data }) => setData(data)}
-   renderItem={({ item, drag, isActive }) => (
-     <ScaleDecorator>
-       <TouchableOpacity onLongPress={drag} disabled={isActive}><Row item={item} /></TouchableOpacity>
-     </ScaleDecorator>
-   )}
- />
+ <SortableList
+   data={data}
+   keyExtractor={(item) => item.id}
+   onReorder={setData}
+   getItemLabel={(item) => item.title}
+   renderItem={({ item, isActive }) => <Row item={item} highlighted={isActive} trailing={<SortableHandle />} />}
+ />
```

| react-native-draggable-flatlist | Patine UI |
| --- | --- |
| `onDragEnd({ data, from, to })` | `onReorder(data, { from, to })` |
| `renderItem({ drag })` + `onLongPress={drag}` | rows lift on a long press by themselves; `<SortableHandle />` lifts at once |
| `activationDistance` / handle-only rows | `activation="handle"` |
| `isActive` | `isActive` |
| `ScaleDecorator` / `ShadowDecorator` | built in: the design's shadow and scale |
| `onDragBegin` | `onDragStart(index)` |
| `autoscrollThreshold` / `autoscrollSpeed` | built in |
| `containerStyle` / FlatList props | `style` / `ScrollView` props |
| `NestableScrollContainer` | — |

There's no Reanimated or gesture handler to install. Keyboard users reorder on the web with Space and the arrow keys, and screen readers get Move up and Move down. [`SortableList`](../../components/sortable-list) renders every row, so it suits lists up to a few hundred rows.

See [all migration guides](./index.mdx) for other libraries, and [Comparison](../comparison.mdx) for when another library is the better choice.
