Authored by QC-L

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

... ... @@ -27,6 +27,7 @@ export default class Home extends Component {
this._renderRow = this._renderRow.bind(this);
this._renderSectionHeader = this._renderSectionHeader.bind(this);
this._floorCellRender = this._floorCellRender.bind(this);
this._clickCategorySelector = this._clickCategorySelector.bind(this);
this.dataSource = new ListView.DataSource({
rowHasChanged: (r1, r2) => !Immutable.is(r1, r2),
... ... @@ -44,6 +45,7 @@ export default class Home extends Component {
<CategorySelector
data={categoryList}
selectedCategoryIndex={selectedCategoryIndex}
changeCategorySelectorTitle={this._clickCategorySelector}
onPressCategory={(rowData, rowID) => {
this.props.onPressCategory && this.props.onPressCategory(rowData, rowID);
}}
... ... @@ -55,6 +57,16 @@ export default class Home extends Component {
}
}
_clickCategorySelector(rowData) {
let params = {
animated: true,
sectionIndex: 1,
itemIndex: 0,
viewOffset: 44
}
this.sectionList.scrollToLocation(params);
}
_renderRow(item) {
let rowID = item.index;
let rowData = item.item;
... ... @@ -174,9 +186,7 @@ export default class Home extends Component {
isShowGuide={this.props.isShowGuide}
hiddenGuideDialog={this.props.hiddenGuideDialog}/>
<SectionList
ref={(c) => {
this.listView = c;
}}
ref={(ref) => this.sectionList = ref}
sections={dataSource}
renderSectionHeader={this._renderSectionHeader}
yh_viewVisible={true}
... ...
... ... @@ -68,6 +68,7 @@ export default class CategorySelector extends Component {
onPress={() => {
this.scrollToCenter(rowID);
this.props.onPressCategory && this.props.onPressCategory(rowData, rowID);
this.props.changeCategorySelectorTitle && this.props.changeCategorySelectorTitle(rowData);
}}
onLayout={(event) => {
this.rowPosition[rowID] = event.nativeEvent.layout;
... ... @@ -105,14 +106,6 @@ export default class CategorySelector extends Component {
};
let {width} = Dimensions.get('window');
const DEVICE_WIDTH_RATIO = width / 320;
let imageWidth = Math.floor(width / 2);
let imageHeight = Math.floor(imageWidth * 180 / 375);
let selectorHeight = Math.ceil(45 * DEVICE_WIDTH_RATIO);
selectorHeight = 45;
let styles = StyleSheet.create({
container: {
... ...