所以我们想要的是:
在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)