简体   繁体   English

React Native:如何在“网格”视图中划分五行?

[英]React native: How can I divided five Rows in Grid view?

I am Developing Sample Grid View Project in Grid view. 我正在网格视图中开发示例网格视图项目。 I am Getting two Rows in grid view. 我在网格视图中得到两行。 but i want displayed in three rows 但我想显示三行

here this is my Code: 这是我的代码:

var CELLS_PER_ROW = 2;

 <GridView
            key={this.props.key}
           items={this.state.dataSource}
          itemsPerRow={CELLS_PER_ROW}
          renderItem={this.renderItem.bind(this)}
           style={{padding:15}}/>

Simply assign CELLS_PER_ROW with number of rows you want. 只需为CELLS_PER_ROW分配所需的行数即可。 Here is the code 这是代码

 `var CELLS_PER_ROW = 3; // number of rows you want

 <GridView
            key={this.props.key}
           items={this.state.dataSource}
          itemsPerRow={CELLS_PER_ROW}
          renderItem={this.renderItem.bind(this)}
           style={{padding:15}}/>`

Hope it works for you :-) . 希望这对你有用 :-) 。

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

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