我正在使用react-native-tableview来显示数据列表。
这是我的代码
<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>
现在带有虚拟数据的简单表格即将出现。
我有两个问题
我有一个数组,我想显示表格中的全部内容。我们怎样才能实现这一目标?
无法增加 css 中的行高、节高。如何增加单元高度?
如有任何帮助,我们将不胜感激。提前致谢。
最佳答案
我找到了第一个问题的答案。 如何在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>
关于javascript - 如何在ios中的react-native-tableview中显示数组数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44542083/