本文内容
1、左滑出现删除按钮
可以自定义滑动出来的component
https://github.com/dancormier/react-native-swipeout
使用
npm install --save react-native-swipeout
import Swipeout from 'react-native-swipeout';
renderRowList(rowData, sectionID, rowID) {
// 声明右侧按钮,更多属性访问 https://github.com/dancormier/react-native-swipeout
const swipeoutBtns = [
{
text: '删除',
backgroundColor: 'red',
onPress: ()=>{
this.deleteItem(rowID);
},
// 自定义component
component: [
],
}
];
return (
//更多属性访问 https://github.com/dancormier/react-native-swipeout
{
this.setState({
sectionID,
rowID,
});
}}
onClose={() => console.log('===close') }
scroll={event => console.log('scroll event') }
>
)
}
this.renderRowList(rowData, sectionID, rowID)}
enableEmptySections={true}
/>