Authored by 孙凯

add 品牌一览 review by zhanglixia

... ... @@ -111,13 +111,12 @@ export default class BrandStore extends Component {
break;
case '1':
{
return null;
// return (
// <BrandListCell
// resource={rowData}
// onPressBrandItem={this.props.onPressBrandItem}
// />
// );
return (
<BrandListCell
resource={rowData}
onPressBrandItem={this.props.onPressBrandItem}
/>
);
}
break;
case '2':
... ...
... ... @@ -17,7 +17,9 @@ const {
export default class BrandListCell extends React.Component {
constructor(props) {
super(props);
let ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2});
this.dataSource = new ListView.DataSource({
rowHasChanged: (r1, r2) => !Immutable.is(r1, r2),
});
}
_pressRow(rowData){
... ... @@ -26,21 +28,19 @@ export default class BrandListCell extends React.Component {
renderRow(rowData,sectionID,rowID,highlightRow) {
return (
<TouchableOpacity activeOpacity={0.5} onPress={() => this._pressRow(rowData)}>
<View style={styles.row}>
<Image
source={{uri: rowData.src}}
// source={require('../../../../image/2.png')}
style={{ width: 100, height: 120}}
resizeMode={'cover'}
></Image>
<Text style={styles.text}>
{rowData.name}
</Text>
</View>
</TouchableOpacity>
<TouchableOpacity activeOpacity={0.5} onPress={() => {
this.props.onPressRecommendItem && this.props.onPressBrandItem(rowData.url);
}}>
<View style={styles.row}>
<Image
source={{uri: rowData.src}}
style={{ width: 100, height: 120}}
></Image>
<Text style={styles.text}>
{rowData.name}
</Text>
</View>
</TouchableOpacity>
);
}
... ... @@ -55,9 +55,9 @@ export default class BrandListCell extends React.Component {
return (
<View style={styles.cellList}>
<Text style={styles.titleStyle}>
品牌一览
</Text>
<View style={styles.titleStyle}>
<Text style={styles.titleText} numberOfLines={1}>品牌一览</Text>
</View>
<ListView
showsHorizontalScrollIndicator ={false}
dataSource={this.dataSource.cloneWithRows(list)}
... ... @@ -76,25 +76,32 @@ let styles = StyleSheet.create({
height: 200,
},
titleStyle:{
marginTop:8,
alignItems: 'center',
textAlign:'center',
fontWeight: 'bold',
fontSize:28,
width: Dimensions.get('window').width,
height: 30,
alignItems: 'center',
justifyContent: 'center',
height: 64,
width:Dimensions.get('window').width,
backgroundColor: 'white',
},
row: {
justifyContent: 'center',
margin: 3,
marginLeft: 20,
// margin: 3,
width: 100,
height: 140,
height: 100,
backgroundColor: 'white',
alignItems: 'center',
// alignItems: 'center',
},
text: {
flex: 1,
justifyContent: 'center',
fontWeight: 'bold',
color: 'gray',
width: 100,
textAlign: 'center',
backgroundColor:'white',
},
titleText: {
fontWeight: 'bold',
textAlign: 'center',
color: 'gray',
fontSize: 20,
},
});
... ...