Swipeable item — reveal actions on swipe.
Implementation with Swipeable:
1import { Swipeable } from 'react-native-gesture-handler';23function SwipeableItem({ item, onDelete }) {4 const renderRightActions = () => (5 <TouchableOpacity6 onPress={() => onDelete(item.id)}7 style={styles.deleteButton}8 >9 <Text style={styles.deleteText}>Delete</Text>10 </TouchableOpacity>11 );1213 return (14 <Swipeable renderRightActions={renderRightActions}>15 <View style={styles.item}>16 <Text>{item.name}</Text>17 </View>18 </Swipeable>19 );20}
With left actions:
1const renderLeftActions = () => (2 <TouchableOpacity style={styles.archiveButton}>3 <Text>Archive</Text>4 </TouchableOpacity>5);67<Swipeable8 renderLeftActions={renderLeftActions}9 renderRightActions={renderRightActions}10>
Swipeable props:
renderRightActions — right swipe content.renderLeftActions — left swipe content.onSwipeableOpen — callback when opened.onSwipeableClose — callback when closed.