【发布时间】:2017-08-09 18:10:15
【问题描述】:
我想根据我获得的数据对表格的每个单元格进行不同的样式设置。如果我使用 Cell 元素,元素总是会创建一个换行符。
如何避免这种情况并在行方向上呈现?
我使用 react-native-table-component,react-native-paginated-listview
<PaginatedListView
style={{ marginBottom:30}}
renderRow={(data,i) =>
{
this._cellBack = !this._cellBack;
return(
<TouchableOpacity onPress={(e) => this._onPressButton(e,data)}>
<View style={styles.button}>
<Cell key="1" data="1" height={28} style={[styles.tableCell, this._cellBack && {backgroundColor: '#DFF5F2'}]} textStyle={styles.tableCellText} widthArr={this._widthArr} myProp="10"/>
<Cell key="2" data="2" height={28} style={[styles.tableCell, this._cellBack && {backgroundColor: '#DFF5F2'}]} textStyle={styles.tableCellText} widthArr={this._widthArr} myProp="10"/>
</View>
</TouchableOpacity>
);
}
}
itemsPerPage={this._LOADLIMIT}
onFetch={::this.onFetch}
autoFetch={false}/>
【问题讨论】:
-
更改样式可能有助于您查看 style={{flexDireaction:'row'}}
-
谢谢,我必须将视图方向设置为行
-
请为我的回答点赞,谢谢
标签: react-native