Authored by 孙凯

add 品牌一览 review by zhanglixia

@@ -111,13 +111,12 @@ export default class BrandStore extends Component { @@ -111,13 +111,12 @@ export default class BrandStore extends Component {
111 break; 111 break;
112 case '1': 112 case '1':
113 { 113 {
114 - return null;  
115 - // return (  
116 - // <BrandListCell  
117 - // resource={rowData}  
118 - // onPressBrandItem={this.props.onPressBrandItem}  
119 - // />  
120 - // ); 114 + return (
  115 + <BrandListCell
  116 + resource={rowData}
  117 + onPressBrandItem={this.props.onPressBrandItem}
  118 + />
  119 + );
121 } 120 }
122 break; 121 break;
123 case '2': 122 case '2':
@@ -17,7 +17,9 @@ const { @@ -17,7 +17,9 @@ const {
17 export default class BrandListCell extends React.Component { 17 export default class BrandListCell extends React.Component {
18 constructor(props) { 18 constructor(props) {
19 super(props); 19 super(props);
20 - let ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2}); 20 + this.dataSource = new ListView.DataSource({
  21 + rowHasChanged: (r1, r2) => !Immutable.is(r1, r2),
  22 + });
21 } 23 }
22 24
23 _pressRow(rowData){ 25 _pressRow(rowData){
@@ -26,21 +28,19 @@ export default class BrandListCell extends React.Component { @@ -26,21 +28,19 @@ export default class BrandListCell extends React.Component {
26 28
27 renderRow(rowData,sectionID,rowID,highlightRow) { 29 renderRow(rowData,sectionID,rowID,highlightRow) {
28 return ( 30 return (
29 - <TouchableOpacity activeOpacity={0.5} onPress={() => this._pressRow(rowData)}>  
30 - <View style={styles.row}>  
31 -  
32 - <Image  
33 - source={{uri: rowData.src}}  
34 - // source={require('../../../../image/2.png')}  
35 - style={{ width: 100, height: 120}}  
36 - resizeMode={'cover'}  
37 - ></Image>  
38 -  
39 - <Text style={styles.text}>  
40 - {rowData.name}  
41 - </Text>  
42 - </View>  
43 - </TouchableOpacity> 31 + <TouchableOpacity activeOpacity={0.5} onPress={() => {
  32 + this.props.onPressRecommendItem && this.props.onPressBrandItem(rowData.url);
  33 + }}>
  34 + <View style={styles.row}>
  35 + <Image
  36 + source={{uri: rowData.src}}
  37 + style={{ width: 100, height: 120}}
  38 + ></Image>
  39 + <Text style={styles.text}>
  40 + {rowData.name}
  41 + </Text>
  42 + </View>
  43 + </TouchableOpacity>
44 ); 44 );
45 } 45 }
46 46
@@ -55,9 +55,9 @@ export default class BrandListCell extends React.Component { @@ -55,9 +55,9 @@ export default class BrandListCell extends React.Component {
55 55
56 return ( 56 return (
57 <View style={styles.cellList}> 57 <View style={styles.cellList}>
58 - <Text style={styles.titleStyle}>  
59 - 品牌一览  
60 - </Text> 58 + <View style={styles.titleStyle}>
  59 + <Text style={styles.titleText} numberOfLines={1}>品牌一览</Text>
  60 + </View>
61 <ListView 61 <ListView
62 showsHorizontalScrollIndicator ={false} 62 showsHorizontalScrollIndicator ={false}
63 dataSource={this.dataSource.cloneWithRows(list)} 63 dataSource={this.dataSource.cloneWithRows(list)}
@@ -76,25 +76,32 @@ let styles = StyleSheet.create({ @@ -76,25 +76,32 @@ let styles = StyleSheet.create({
76 height: 200, 76 height: 200,
77 }, 77 },
78 titleStyle:{ 78 titleStyle:{
79 - marginTop:8,  
80 - alignItems: 'center',  
81 - textAlign:'center',  
82 - fontWeight: 'bold',  
83 - fontSize:28,  
84 - width: Dimensions.get('window').width,  
85 - height: 30, 79 + alignItems: 'center',
  80 + justifyContent: 'center',
  81 + height: 64,
  82 + width:Dimensions.get('window').width,
  83 + backgroundColor: 'white',
86 }, 84 },
87 row: { 85 row: {
88 justifyContent: 'center', 86 justifyContent: 'center',
89 - margin: 3, 87 + marginLeft: 20,
  88 + // margin: 3,
90 width: 100, 89 width: 100,
91 - height: 140, 90 + height: 100,
92 backgroundColor: 'white', 91 backgroundColor: 'white',
93 - alignItems: 'center', 92 + // alignItems: 'center',
94 }, 93 },
95 text: { 94 text: {
96 - flex: 1,  
97 - justifyContent: 'center',  
98 fontWeight: 'bold', 95 fontWeight: 'bold',
  96 + color: 'gray',
  97 + width: 100,
  98 + textAlign: 'center',
  99 + backgroundColor:'white',
  100 + },
  101 + titleText: {
  102 + fontWeight: 'bold',
  103 + textAlign: 'center',
  104 + color: 'gray',
  105 + fontSize: 20,
99 }, 106 },
100 }); 107 });