简体   繁体   English

如何在ios中的react-native-tableview中显示数组数据

[英]How to display array data in react-native-tableview in ios

I'm using react-native-tableview to display list of data. 我正在使用react-native-tableview来显示数据列表。

Here's my code 这是我的代码

    <TableView style = {styles.usersTableViewStyle}
                   allowsToggle={true}
                   allowsMultipleSelection={true}
                   tableViewStyle={TableView.Consts.Style.Plain}
                   tableViewCellStyle={TableView.Consts.CellStyle.Subtitle}
                   onPress={(event) => console.log(event)}>

             <Section label="List" style={styles.Section}>
                    <Item> Apple </Item>
                    ....
             </Section>

    </TableView>

Now a simple table with dummy data is coming. 现在,一个带有虚拟数据的简单表即将到来。

I have two questions 我有两个问题

  1. I have one array and I want to display the entire content in table. 我有一个数组,我想在表格中显示整个内容。 How can we achieve this? 我们怎样才能做到这一点?

  2. Can't able to increase the row height, section height in css. 无法在css中增加行高,截面高度。 How to increase the cell height? 如何增加细胞高度?

Anyhelp could be appreciated. Anyhelp可能会受到赞赏。 Thanks in advance. 提前致谢。

I found answer for my first question. 我找到了第一个问题的答案。 How to display array values in tableview? 如何在tableview中显示数组值?

With this code we can display array values in react-native-tableview. 使用此代码,我们可以在react-native-tableview中显示数组值。

<TableView style = {styles.fruitsTableViewStyle}
               allowsToggle={true}
               allowsMultipleSelection={true}
               tableViewStyle={TableView.Consts.Style.Plain}
               tableViewCellStyle={TableView.Consts.CellStyle.Subtitle}
               onPress={(event) => console.log(event)}>

          <Section label = 'List'>
               {
                   fruitsArray.map(function(name, index) {
                        return <Item key = {index} label = {name}>
                                     {name}
                               </Item>
                        )
               }

          </Section>
</TableView>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM