小编Sam*_*asa的帖子

在react-native列表视图上显示多种类型行的正确方法是什么?

所以我们想要的是:

多列型

在iOS中,我们可以为每个单元格类型使用多个cellIdentifier来创建高性能列表视图.

我现在拥有的是什么

render() {
  const dataBlob = [
    { type: "address", data: { address, gotoEditAddress } },

    { type: "deliveryTime", data: {...} },

    { type: "cartSummary", data: {...} },

    ...[items.map(item => {{ type: "item", data: {...} }})],

    { type: "paymentInformation", data: {...} },
    { type: "paymentBreakdown", data: {...} },
    { type: "promoCode", data: {...} },
  ];

  this._dataSource = this._dataSource.cloneWithRows(dataBlob);

  return (
    <ListView ref="ScrollView"
        renderRow={this._renderRow}
        dataSource={this._dataSource} />
  );
)
Run Code Online (Sandbox Code Playgroud)

并在renderRow方法上

_renderRow = (rowData) => {
  const { type, data …
Run Code Online (Sandbox Code Playgroud)

android listview ios react-native react-native-listview

7
推荐指数
1
解决办法
1651
查看次数