Authored by 张丽霞

红人店铺优化及标题。。。位置,review by Redding

... ... @@ -77,7 +77,7 @@ export default class DoubleImage extends React.Component {
}
}
return (
<TouchableOpacity yh_exposureData={new_yh_exposureData} activeOpacity={1.0} onPress={() => {this.props.onPressProduct && this.props.onPressProduct(url,moduleOrder,moduleType,i+1)}} >
<TouchableOpacity key={'row'+i} yh_exposureData={new_yh_exposureData} activeOpacity={1.0} onPress={() => {this.props.onPressProduct && this.props.onPressProduct(url,moduleOrder,moduleType,i+1)}} >
<YH_Image
url={backgroundImage}
style={styles.thumbnail}
... ...
... ... @@ -52,6 +52,7 @@ export default class RedBrand extends Component {
this.containerHeight = 0;
this.sectionData = [];
this.layoutLenghtOffesetForIndex = {};
this.productListUpOffset = 0;
}
_onPressLaunchProfile(value){
... ... @@ -66,7 +67,8 @@ export default class RedBrand extends Component {
let height = headerHeight + 84; //header
this.refs.redBrandList && this.refs.redBrandList.scrollToLocation({itemIndex: 0,sectionIndex: 1, viewPosition: height, animated: false});
} else {
this.refs.redBrandList && this.refs.redBrandList.scrollToLocation({itemIndex: 0,sectionIndex: 2, viewPosition: 0, animated: false});
let height = headerHeight + 84;
this.refs.redBrandList && this.refs.redBrandList.scrollToLocation({itemIndex: 0,sectionIndex: 0, viewOffset: -this.productListUpOffset + 104, animated: false});
}
this.props.onPressProductFilter && this.props.onPressProductFilter(value);
}
... ... @@ -97,7 +99,6 @@ export default class RedBrand extends Component {
if (!shopsdecorator || shopsdecorator.template_type != '1') {
result.length = headerHeight; //header
if (countNumb == layoutIndex) {
this.layoutLenghtOffesetForIndex['fliter' + fliter + 'row' + countNumb] = result;
return result;
}
realContainerHeight += headerHeight; //header
... ... @@ -108,7 +109,6 @@ export default class RedBrand extends Component {
if (countNumb == layoutIndex) {
result.offset = realContainerHeight - 44;
result.length = 44;
this.layoutLenghtOffesetForIndex['fliter' + fliter + 'row' + countNumb] = result;
return result;
}
let sectionDataSource = item.data;
... ... @@ -249,7 +249,6 @@ export default class RedBrand extends Component {
countNumb++;
}
if (validFloorData && countNumb == layoutIndex) {
this.layoutLenghtOffesetForIndex['fliter' + fliter + 'row' + countNumb] = result;
return result;
}
}
... ... @@ -257,12 +256,12 @@ export default class RedBrand extends Component {
} else if (item.key == 'productList') {
let brandFilterContainerHeight = this.props.fliter == '2' ? 84 : 40;
countNumb++; // filter
this.productListUpOffset = realContainerHeight;
if (countNumb == layoutIndex) {
result = {
length: brandFilterContainerHeight,
offset: realContainerHeight
};
this.layoutLenghtOffesetForIndex['fliter' + fliter + 'row' + countNumb] = result;
return result;
} else if (layoutIndex > countNumb) {
let rowHeight = Math.ceil(254 * width / 320);
... ... @@ -271,7 +270,6 @@ export default class RedBrand extends Component {
realContainerHeight += brandFilterContainerHeight;
result.length = rowHeight + rowMarginTop + rowMarginBottom;
result.offset = realContainerHeight + (layoutIndex - countNumb) * result.length;
this.layoutLenghtOffesetForIndex['fliter' + fliter + 'row' + layoutIndex] = result;
return result;
}
}
... ... @@ -284,16 +282,21 @@ export default class RedBrand extends Component {
getItemLayout(data, index) {
let {fliter} = this.props;
let key = key = 'fliter' + fliter + 'row' + index;
let {fliter,shopsdecorator} = this.props;
let key = 'fliter' + fliter + 'row' + index;
let sectionInfo = {
length: 0,
offset: 0,
};
if (shopsdecorator.isFetching) {
sectionInfo = this._calculateSectionRealHeight(this.sectionData, index);
}else {
if (this.layoutLenghtOffesetForIndex[key]) {
sectionInfo = this.layoutLenghtOffesetForIndex[key];
} else {
sectionInfo = this._calculateSectionRealHeight(this.sectionData, index);
this.layoutLenghtOffesetForIndex[key] = sectionInfo;
}
}
return {length: sectionInfo.length, offset: sectionInfo.offset, index};
}
... ... @@ -307,7 +310,7 @@ export default class RedBrand extends Component {
if (shopsdecorator && shopsdecorator.template_type == '1') {
return <View style={{height:0}}></View>;
} else {
return (<RedBrandStoreFilter key={'sec' + sectionID} resource={fliter} onPressStoreFilter={this._onPressFilter}/>);
return (<RedBrandStoreFilter style={{zIndex: 999}} key={'sec' + sectionID} resource={fliter} onPressStoreFilter={this._onPressFilter}/>);
}
}
case 'productList': {
... ... @@ -323,7 +326,7 @@ export default class RedBrand extends Component {
}
let brandFilterContainerHeight = this.props.fliter == '2' ? 84 : 40;
return (
<View key={'sec' + sectionID} style={[styles.brandFilterContainer,{height:brandFilterContainerHeight}]} onLayout={
<View key={'sec' + sectionID} style={[styles.brandFilterContainer,{height:brandFilterContainerHeight,zIndex: 999}]} onLayout={
(evt) => {yPosition = evt.nativeEvent.layout.y;}}>
{this.props.fliter != '0' ?
<RedBrandStoreFilter resource={fliter} onPressStoreFilter={this._onPressFilter}/>
... ...
... ... @@ -121,7 +121,7 @@ let styles = StyleSheet.create({
height: 38,
top: 1,
bottom: 1,
marginLeft: width - 40,
right: 15,
backgroundColor: 'transparent',
justifyContent: 'center',
},
... ...