Authored by QC-L

修复有赚首页列表悬浮记录高度的问题 review by sunkai

@@ -27,6 +27,7 @@ export default class Home extends Component { @@ -27,6 +27,7 @@ export default class Home extends Component {
27 this._renderRow = this._renderRow.bind(this); 27 this._renderRow = this._renderRow.bind(this);
28 this._renderSectionHeader = this._renderSectionHeader.bind(this); 28 this._renderSectionHeader = this._renderSectionHeader.bind(this);
29 this._floorCellRender = this._floorCellRender.bind(this); 29 this._floorCellRender = this._floorCellRender.bind(this);
  30 + this._clickCategorySelector = this._clickCategorySelector.bind(this);
30 31
31 this.dataSource = new ListView.DataSource({ 32 this.dataSource = new ListView.DataSource({
32 rowHasChanged: (r1, r2) => !Immutable.is(r1, r2), 33 rowHasChanged: (r1, r2) => !Immutable.is(r1, r2),
@@ -44,6 +45,7 @@ export default class Home extends Component { @@ -44,6 +45,7 @@ export default class Home extends Component {
44 <CategorySelector 45 <CategorySelector
45 data={categoryList} 46 data={categoryList}
46 selectedCategoryIndex={selectedCategoryIndex} 47 selectedCategoryIndex={selectedCategoryIndex}
  48 + changeCategorySelectorTitle={this._clickCategorySelector}
47 onPressCategory={(rowData, rowID) => { 49 onPressCategory={(rowData, rowID) => {
48 this.props.onPressCategory && this.props.onPressCategory(rowData, rowID); 50 this.props.onPressCategory && this.props.onPressCategory(rowData, rowID);
49 }} 51 }}
@@ -55,6 +57,16 @@ export default class Home extends Component { @@ -55,6 +57,16 @@ export default class Home extends Component {
55 } 57 }
56 } 58 }
57 59
  60 + _clickCategorySelector(rowData) {
  61 + let params = {
  62 + animated: true,
  63 + sectionIndex: 1,
  64 + itemIndex: 0,
  65 + viewOffset: 44
  66 + }
  67 + this.sectionList.scrollToLocation(params);
  68 + }
  69 +
58 _renderRow(item) { 70 _renderRow(item) {
59 let rowID = item.index; 71 let rowID = item.index;
60 let rowData = item.item; 72 let rowData = item.item;
@@ -174,9 +186,7 @@ export default class Home extends Component { @@ -174,9 +186,7 @@ export default class Home extends Component {
174 isShowGuide={this.props.isShowGuide} 186 isShowGuide={this.props.isShowGuide}
175 hiddenGuideDialog={this.props.hiddenGuideDialog}/> 187 hiddenGuideDialog={this.props.hiddenGuideDialog}/>
176 <SectionList 188 <SectionList
177 - ref={(c) => {  
178 - this.listView = c;  
179 - }} 189 + ref={(ref) => this.sectionList = ref}
180 sections={dataSource} 190 sections={dataSource}
181 renderSectionHeader={this._renderSectionHeader} 191 renderSectionHeader={this._renderSectionHeader}
182 yh_viewVisible={true} 192 yh_viewVisible={true}
@@ -68,6 +68,7 @@ export default class CategorySelector extends Component { @@ -68,6 +68,7 @@ export default class CategorySelector extends Component {
68 onPress={() => { 68 onPress={() => {
69 this.scrollToCenter(rowID); 69 this.scrollToCenter(rowID);
70 this.props.onPressCategory && this.props.onPressCategory(rowData, rowID); 70 this.props.onPressCategory && this.props.onPressCategory(rowData, rowID);
  71 + this.props.changeCategorySelectorTitle && this.props.changeCategorySelectorTitle(rowData);
71 }} 72 }}
72 onLayout={(event) => { 73 onLayout={(event) => {
73 this.rowPosition[rowID] = event.nativeEvent.layout; 74 this.rowPosition[rowID] = event.nativeEvent.layout;
@@ -105,14 +106,6 @@ export default class CategorySelector extends Component { @@ -105,14 +106,6 @@ export default class CategorySelector extends Component {
105 }; 106 };
106 107
107 let {width} = Dimensions.get('window'); 108 let {width} = Dimensions.get('window');
108 -const DEVICE_WIDTH_RATIO = width / 320;  
109 -  
110 -let imageWidth = Math.floor(width / 2);  
111 -let imageHeight = Math.floor(imageWidth * 180 / 375);  
112 -  
113 -let selectorHeight = Math.ceil(45 * DEVICE_WIDTH_RATIO);  
114 -  
115 -selectorHeight = 45;  
116 109
117 let styles = StyleSheet.create({ 110 let styles = StyleSheet.create({
118 container: { 111 container: {