用滑动区删除区

时间:2019-04-23 03:33:50

标签: react-native react-native-sectionlist

我是本机反应的新手 我想要一个带有滑动的部分列表以删除功能。 我找到了这个库:react-native-swipeout 与FlatList一起很好地工作, 我设法仅将刷卡添加到了部分标题,但我想将整个部分作为一个单元一起刷卡。

添加当前情况的图片

enter image description here

灰色背景是节标题,白色是数据数组 代码段

renderSectionHeader = ({section, index}) => {

    const swipeSettings = {
        autoClose: true,
        onColse: (secId, rowId, direction) => {

        },
        onOpen: (secId, rowId, direction) => {

        },
        right: [
            {
                onPress: () => {
                },
                text: 'Remove', type: 'delete'
            }
        ],
        rowId: 1,
        sectionId: index,
        //  set active swipeout item
        _handleSwipeout: (sectionID, rowID) => {
            for (var i = 0; i < rows.length; i++) {
                rows[i].active = i == rowID;
            }
            this._updateDataSource(rows)
        },
    };

    return (

        <Swipeout
            {...swipeSettings}
        >
            <View style={{justifyContent: 'space-between'}}>
                <Text>{section.itemName}</Text>
                <Text>${section.itemTotalPrice}</Text>
            </View>
         </Swipeout>

    )
};

0 个答案:

没有答案
相关问题