Authored by 张丽霞

为您推荐UI,review by redding

@@ -50,16 +50,9 @@ export default class RecommendForYou extends Component { @@ -50,16 +50,9 @@ export default class RecommendForYou extends Component {
50 /> 50 />
51 ) 51 )
52 } 52 }
53 - _renderSeperator(){ 53 + _renderSeperator(sectionID, rowID){
54 return ( 54 return (
55 - <View style={styles.seperatorView}>  
56 - </View>  
57 - );  
58 - }  
59 -  
60 - _renderHeader(){  
61 - return (  
62 - <View style={styles.seperatorView}> 55 + <View style={styles.seperatorView} key={`${sectionID}-${rowID}`}>
63 </View> 56 </View>
64 ); 57 );
65 } 58 }
@@ -67,8 +60,8 @@ export default class RecommendForYou extends Component { @@ -67,8 +60,8 @@ export default class RecommendForYou extends Component {
67 render() { 60 render() {
68 let {resource} = this.props; 61 let {resource} = this.props;
69 let dataSource = { 62 let dataSource = {
70 - hotBrandList: resource.get('hotBrandList').toArray(),  
71 browseBrandList: resource.get('browseBrandList').toArray(), 63 browseBrandList: resource.get('browseBrandList').toArray(),
  64 + hotBrandList: resource.get('hotBrandList').toArray(),
72 newBrandList: resource.get('newBrandList').toArray(), 65 newBrandList: resource.get('newBrandList').toArray(),
73 }; 66 };
74 return ( 67 return (
@@ -78,7 +71,6 @@ export default class RecommendForYou extends Component { @@ -78,7 +71,6 @@ export default class RecommendForYou extends Component {
78 dataSource={this.dataSource.cloneWithRows(dataSource)} 71 dataSource={this.dataSource.cloneWithRows(dataSource)}
79 renderRow={this._renderRow} 72 renderRow={this._renderRow}
80 renderSeparator={this._renderSeperator} 73 renderSeparator={this._renderSeperator}
81 - renderHeader={this._renderHeader}  
82 enableEmptySections={true} 74 enableEmptySections={true}
83 /> 75 />
84 76
@@ -91,7 +83,8 @@ let {width, height} = Dimensions.get('window'); @@ -91,7 +83,8 @@ let {width, height} = Dimensions.get('window');
91 83
92 let styles = StyleSheet.create({ 84 let styles = StyleSheet.create({
93 container: { 85 container: {
94 - flex: 1, 86 + width: width,
  87 + height: height - 64,
95 backgroundColor: '#f0f0f0', 88 backgroundColor: '#f0f0f0',
96 }, 89 },
97 contentContainer: { 90 contentContainer: {
@@ -24,12 +24,13 @@ export default class RecommendForYouCell extends Component { @@ -24,12 +24,13 @@ export default class RecommendForYouCell extends Component {
24 let {title, dataSource} = this.props; 24 let {title, dataSource} = this.props;
25 let hideNewNum = false; 25 let hideNewNum = false;
26 let footerHeight = 46; 26 let footerHeight = 46;
  27 + let selfShowHeight = selfHeaderViewHeight + selfFooterViewHeight + TitleNumbCellHeight * Math.ceil(dataSource.length / 3);
27 if (title == '新入驻品牌') { 28 if (title == '新入驻品牌') {
28 hideNewNum = true; 29 hideNewNum = true;
29 footerHeight = 30; 30 footerHeight = 30;
30 } 31 }
31 return ( 32 return (
32 - <View style={styles.container}> 33 + <View style={[styles.container,{height: selfShowHeight}]}>
33 <View style={styles.header}> 34 <View style={styles.header}>
34 <Text style={styles.headerText}>{title}</Text> 35 <Text style={styles.headerText}>{title}</Text>
35 </View> 36 </View>
@@ -37,7 +38,7 @@ export default class RecommendForYouCell extends Component { @@ -37,7 +38,7 @@ export default class RecommendForYouCell extends Component {
37 {dataSource.map((item, i) => { 38 {dataSource.map((item, i) => {
38 return( 39 return(
39 <RecForYouIconTitleNumbCell 40 <RecForYouIconTitleNumbCell
40 - key={i} 41 + key={"TitleNumbCell" +i}
41 dataSource = {item} 42 dataSource = {item}
42 hideNewNum={hideNewNum} 43 hideNewNum={hideNewNum}
43 onPressShop={this.props.onPressShop} 44 onPressShop={this.props.onPressShop}
@@ -54,6 +55,9 @@ export default class RecommendForYouCell extends Component { @@ -54,6 +55,9 @@ export default class RecommendForYouCell extends Component {
54 } 55 }
55 56
56 let {width, height} = Dimensions.get('window'); 57 let {width, height} = Dimensions.get('window');
  58 +let TitleNumbCellHeight = Math.ceil((Dimensions.get('window').width - 40) / 3) + 26;
  59 +let selfHeaderViewHeight = 30;
  60 +let selfFooterViewHeight = 30;
57 61
58 let styles = StyleSheet.create({ 62 let styles = StyleSheet.create({
59 container: { 63 container: {
@@ -63,7 +67,7 @@ let styles = StyleSheet.create({ @@ -63,7 +67,7 @@ let styles = StyleSheet.create({
63 header: { 67 header: {
64 backgroundColor: 'white', 68 backgroundColor: 'white',
65 width: width, 69 width: width,
66 - height: 40, 70 + height: selfHeaderViewHeight,
67 alignItems: 'center', 71 alignItems: 'center',
68 flexDirection: 'row', 72 flexDirection: 'row',
69 }, 73 },
@@ -73,6 +77,7 @@ let styles = StyleSheet.create({ @@ -73,6 +77,7 @@ let styles = StyleSheet.create({
73 width: width, 77 width: width,
74 textAlign: 'center', 78 textAlign: 'center',
75 backgroundColor: 'white', 79 backgroundColor: 'white',
  80 + marginTop: 12,
76 }, 81 },
77 contentContainer: { 82 contentContainer: {
78 backgroundColor: 'white', 83 backgroundColor: 'white',
@@ -82,7 +87,7 @@ let styles = StyleSheet.create({ @@ -82,7 +87,7 @@ let styles = StyleSheet.create({
82 87
83 }, 88 },
84 footer: { 89 footer: {
85 - height: 16, 90 + height: selfFooterViewHeight,
86 backgroundColor: 'white', 91 backgroundColor: 'white',
87 }, 92 },
88 cellContainer: { 93 cellContainer: {