Authored by QC-L

更新首页和爆款推荐筛选栏悬浮效果

... ... @@ -25,6 +25,7 @@ export default class Home extends Component {
super(props);
this._renderRow = this._renderRow.bind(this);
this._renderSectionHeader = this._renderSectionHeader.bind(this);
this._floorCellRender = this._floorCellRender.bind(this);
this.dataSource = new ListView.DataSource({
... ... @@ -33,6 +34,27 @@ export default class Home extends Component {
});
}
_renderSectionHeader(sectionData, sectionID) {
switch (sectionID) {
case 'categoryList': {
let { productList } = this.props.data;
let selectedCategoryIndex = productList.selectedCategoryIndex;
let categoryList = productList.msort_list.unshift(hotRecommend);
return (
<CategorySelector
data={categoryList}
selectedCategoryIndex={selectedCategoryIndex}
onPressCategory={(rowData, rowID) => {
this.props.onPressCategory && this.props.onPressCategory(rowData, rowID);
}}
/>
);
}
default:
return null;
}
}
_renderRow(rowData, sectionID, rowID) {
let paddingLeft = rowID % 2 === 1 ? rowMarginHorizontal / 2 : rowMarginHorizontal;
let customStyle = rowID === 0 || rowID === 1 ? {paddingLeft} : {paddingLeft};
... ... @@ -65,21 +87,6 @@ export default class Home extends Component {
);
}
case 'categoryList': {
let {productList} = this.props.data;
let selectedCategoryIndex = productList.selectedCategoryIndex;
let categoryList = productList.msort_list.unshift(hotRecommend);
return (
<CategorySelector
data={categoryList}
selectedCategoryIndex={selectedCategoryIndex}
onPressCategory={(rowData, rowID) => {
this.props.onPressCategory && this.props.onPressCategory(rowData, rowID);
}}
/>
);
}
default:
return null;
}
... ... @@ -168,6 +175,7 @@ export default class Home extends Component {
ref={(c) => {
this.listView = c;
}}
renderSectionHeader={this._renderSectionHeader}
yh_viewVisible={true}
contentContainerStyle={styles.contentContainer}
enableEmptySections={true}
... ...
... ... @@ -21,6 +21,7 @@ export default class Recommend extends Component {
super(props);
this.renderRow = this.renderRow.bind(this);
this._renderSectionHeader = this._renderSectionHeader.bind(this);
this.dataSource = new ListView.DataSource({
rowHasChanged: (r1, r2) => !Immutable.is(r1, r2),
... ... @@ -30,6 +31,28 @@ export default class Recommend extends Component {
this.listView = null;
}
_renderSectionHeader(sectionData, sectionID) {
switch (sectionID) {
case 'categoryList': {
let {productList} = this.props.data;
let selectedCategoryIndex = productList.selectedCategoryIndex;
let categoryList = productList.msort_list.unshift(hotRecommend);
return (
<CategorySelector
data={categoryList}
selectedCategoryIndex={selectedCategoryIndex}
onPressCategory={(rowData, rowID) => {
// this.listView && this.listView.scrollTo({x: 0, y: 0, animated: false});
this.props.onPressCategory && this.props.onPressCategory(rowData, rowID);
}}
/>
);
}
default:
return null;
}
}
renderRow(rowData, sectionID, rowID) {
let sliderHeight = 118 * DEVICE_WIDTH_RATIO;
let imageUrl = YH_Image.getSlicedUrl(this.props.src, width, sliderHeight, 2);
... ... @@ -50,21 +73,7 @@ export default class Recommend extends Component {
</TouchableOpacity>
);
}
case 'categoryList': {
let {productList} = this.props.data;
let selectedCategoryIndex = productList.selectedCategoryIndex;
let categoryList = productList.msort_list.unshift(hotRecommend);
return (
<CategorySelector
data={categoryList}
selectedCategoryIndex={selectedCategoryIndex}
onPressCategory={(rowData, rowID) => {
// this.listView && this.listView.scrollTo({x: 0, y: 0, animated: false});
this.props.onPressCategory && this.props.onPressCategory(rowData, rowID);
}}
/>
);
}
case 'productList': {
return (
<ProductCell
... ... @@ -97,6 +106,7 @@ export default class Recommend extends Component {
ref={(c) => {
this.listView = c;
}}
renderSectionHeader={this._renderSectionHeader}
enableEmptySections={true}
yh_viewVisible={true}
dataSource={this.dataSource.cloneWithRowsAndSections(dataSource)}
... ...
... ... @@ -68,7 +68,7 @@ class RecommendContainer extends Component {
productPool,
skns,
} = this.props.app;
this.props.actions.setAppSelectedCategory(productPool, skns, data.get('sort_id'), index);
this.props.actions.setAppSelectedCategory(productPool, skns, data.get('sort_id'), data.get('sort_name'), index);
}
onPressProduct(product) {
... ...