反应本机表单元格填充整行而不是仅单元格

时间:2019-09-24 21:55:20

标签: react-native

我试图在react native中创建一个表,但是单元格填充了整个行空间,而不仅仅是单元格。为什么?

import { Table, TableWrapper, Row, Cell } from 'react-native-table-component';
...

this.state = {
      tenantData: {},
      tenantLedger: [],
      tableHead: ['Date of Credit', 'Description', 'Charge', 'Credit', 'Balance'],
      widthArr: [80, 95, 65, 65, 65]
};
...

<Table borderStyle={{ borderWidth: 1, borderColor: '#C1C0B9'}}>
   <Row
      data={this.state.tableHead}
      style={styles.head}
      textStyle={styles.text}
      widthArr={this.state.widthArr}
   />
   {
      tableData.map((rowData, index) => (
         <TableWrapper key={index} style={styles.row}>
            {
               rowData.map((cellData, cellIndex) => (
                  <Cell key={cellIndex} data={cellData} textStyle={styles.text} />
               ))
            }
         </TableWrapper>
      ))
   }
</Table>
...

text: { textAlign: 'center', fontWeight: '100' },
row: { height: 40, backgroundColor: '#E7E6E1' },
head: { height: 40, backgroundColor: '#f1f8ff' },

我的输出是: enter image description here

有人知道为什么细胞的位置不正确吗?

谢谢

1 个答案:

答案 0 :(得分:-1)

您不需要“ TableWrapper”和“ Cell”来显示数据。 “单元格”将具有完整宽度。如果您只想显示数据

替换

MM/dd/yyyy

使用

          #include <stdio.h>

       void loop_down_to_zero(int number);
       void loop_up_to_int(int number);

      int main(int argc, char* argv[])
    {
      printf("please enter a positive integer:");
      int number;
      number = ("%d" >= 0);
      loop_down_to_zero(number);
      loop_up_to_int(number);
      scanf("%d", &number);
      printf("****\n");

      return 0;
    }

     void loop_down_to_zero(int number)
     {
      while ( number > 0 )
     {
        loop_down_to_zero(number - 1);
        printf("\n%d", number-1);

     }

     }

    void loop_up_to_int(int number)
   {
    while ( number >= 0 )
   {
      loop_up_to_int(number+ 1);
      printf("%d\n", number+1);
    } 
     return;
     }

注意:从“ react-native-table-component”导入“行”;