Migrate from react-native-swipe-list-view
- import { SwipeListView } from 'react-native-swipe-list-view';
+ import { List, ListItem, SwipeableRow } from 'patine-ui';
- <SwipeListView
- data={mail}
- renderItem={({ item }) => <MailRow mail={item} />}
- renderHiddenItem={({ item }) => <HiddenDeleteButton onPress={() => remove(item.id)} />}
- rightOpenValue={-75}
- closeOnRowOpen
- />
+ <List>
+ {mail.map((item) => (
+ <SwipeableRow key={item.id} fullSwipe trailingActions={[{ label: 'Delete', variant: 'destructive', onPress: () => remove(item.id) }]}>
+ <ListItem title={item.subject} />
+ </SwipeableRow>
+ ))}
+ </List>
| react-native-swipe-list-view | Patine UI |
|---|---|
renderHiddenItem | leadingActions / trailingActions: { label, icon?, variant?, color?, onPress }[] |
rightOpenValue / leftOpenValue | the actions' width (74–88pt each, by design) |
closeOnRowOpen | always: opening a row closes the others |
closeOnRowPress | always: tapping an open row closes it |
rightActivationValue + onRightAction | fullSwipe: a long swipe runs the edge action |
disableRightSwipe / disableLeftSwipe | leave that side's actions out |
onRowOpen / onRowClose | onOpenChange(side | null) |
SwipeRow | SwipeableRow |
Wrap rows in any list you use, a FlatList included. Screen readers reach the actions without swiping, and on the web the arrow keys open a focused row.
See all migration guides for other libraries, and Comparison for when another library is the better choice.