Authored by 孙凯

整理代码 review by 红魔

... ... @@ -85,64 +85,42 @@ export default class BrandStore extends Component {
switch (rowID) {
case '0':
{
if (rowData != null) {
return null;
}else {
return null;
}
return null;
}
break;
case '1':
{
if (rowData != null) {
return null;
}else {
return null;
}
return null;
}
break;
case '2':
{
if (rowData != null) {
return (
<BrandSwiper
resource={rowData}
onPressBrandItem={this.props.onPressBrandItem}
/>
);
}else {
return null;
}
return (
<BrandSwiper
resource={rowData}
onPressBrandItem={this.props.onPressBrandItem}
/>
);
}
break;
case '3':
{
if (rowData != null) {
return (
<OneRowTwoColImages
resource={rowData}
onPressOneRowTwoColImages={this.props.onPressOneRowTwoColImages}
/>
);
}else {
return null;
}
return (
<OneRowTwoColImages
resource={rowData}
onPressOneRowTwoColImages={this.props.onPressOneRowTwoColImages}
/>
);
}
break;
case '4':
{
if (rowData != null) {
return (
<Recommend
resource={rowData}
onPressRecommendItem={this.props.onPressRecommendItem}
/>
);
}else {
return null;
}
return (
<Recommend
resource={rowData}
onPressRecommendItem={this.props.onPressRecommendItem}
/>
);
}
break;
default:
... ...
... ... @@ -70,18 +70,23 @@ export default class Recommend extends React.Component {
let backgroundWidth = Dimensions.get('window').width;
let backgroundHeight = 64 + 20 + Math.ceil(list.size/4) * Dimensions.get('window').width/4;
return (
<View style={{width: backgroundWidth,height:backgroundHeight,backgroundColor:'#f0f0f0'}}>
<ListView
automaticallyAdjustContentInsets={false}
contentContainerStyle={styles.grid}
dataSource={this.dataSource.cloneWithRows(list)}
renderRow={this.renderRow.bind(this)}
renderHeader = {this.renderHeader.bind(this)}
pageSize={Math.ceil(data.length/4)}
/>
</View>
);
if (list != null) {
return (
<View style={{width: backgroundWidth,height:backgroundHeight,backgroundColor:'#f0f0f0'}}>
<ListView
automaticallyAdjustContentInsets={false}
contentContainerStyle={styles.grid}
dataSource={this.dataSource.cloneWithRows(list)}
renderRow={this.renderRow.bind(this)}
renderHeader = {this.renderHeader.bind(this)}
pageSize={Math.ceil(data.length/4)}
/>
</View>
);
}else {
return null;
}
}
};
... ...