如何使用“ react-native-table-component”添加删除行选项?

时间:2019-06-04 06:30:22

标签: react-native

我正在使用这个库react-native-table-componeny,我想添加一个删除行选项!

<View>
  <Table borderStyle={{ borderColor: '#C1C0B9' }}>
    <Row data={this.state.tableHead} style={styles.head} textStyle={styles.text} />
  </Table>
  <ScrollView style={styles.dataWrapper}>
    <Table borderStyle={{ borderColor: '#C1C0B9' }}>
      {this.state.tableData.map((tableData1, index) => (
        <Row
          key={index}
          data={tableData1}
          style={[styles.row, index % 2 && { backgroundColor: '#F7F6E7' }]}
          textStyle={styles.text}
        />

        // this.state.tableData.map((rowData, index) => (
        //   <TableWrapper key={index} style={styles.row}>
        //     {
        //       rowData.map((cellData, cellIndex) => (
        //         <Cell key={cellIndex} data={cellIndex === 2 ? element(cellData, index) : cellData} textStyle={styles.text}/>
        //       ))
        //     }
        //   </TableWrapper>
      ))}
    </Table>
  </ScrollView>
</View>

我希望该行应具有删除图标,并且当我单击该行时应删除它。

赞:

enter image description here

0 个答案:

没有答案