|
@@ -52,6 +52,7 @@ export default class RedBrand extends Component { |
|
@@ -52,6 +52,7 @@ export default class RedBrand extends Component { |
52
|
this.containerHeight = 0;
|
52
|
this.containerHeight = 0;
|
53
|
this.sectionData = [];
|
53
|
this.sectionData = [];
|
54
|
this.layoutLenghtOffesetForIndex = {};
|
54
|
this.layoutLenghtOffesetForIndex = {};
|
|
|
55
|
+ this.productListUpOffset = 0;
|
55
|
}
|
56
|
}
|
56
|
|
57
|
|
57
|
_onPressLaunchProfile(value){
|
58
|
_onPressLaunchProfile(value){
|
|
@@ -66,7 +67,8 @@ export default class RedBrand extends Component { |
|
@@ -66,7 +67,8 @@ export default class RedBrand extends Component { |
66
|
let height = headerHeight + 84; //header
|
67
|
let height = headerHeight + 84; //header
|
67
|
this.refs.redBrandList && this.refs.redBrandList.scrollToLocation({itemIndex: 0,sectionIndex: 1, viewPosition: height, animated: false});
|
68
|
this.refs.redBrandList && this.refs.redBrandList.scrollToLocation({itemIndex: 0,sectionIndex: 1, viewPosition: height, animated: false});
|
68
|
} else {
|
69
|
} else {
|
69
|
- this.refs.redBrandList && this.refs.redBrandList.scrollToLocation({itemIndex: 0,sectionIndex: 2, viewPosition: 0, animated: false});
|
70
|
+ let height = headerHeight + 84;
|
|
|
71
|
+ this.refs.redBrandList && this.refs.redBrandList.scrollToLocation({itemIndex: 0,sectionIndex: 0, viewOffset: -this.productListUpOffset + 104, animated: false});
|
70
|
}
|
72
|
}
|
71
|
this.props.onPressProductFilter && this.props.onPressProductFilter(value);
|
73
|
this.props.onPressProductFilter && this.props.onPressProductFilter(value);
|
72
|
}
|
74
|
}
|
|
@@ -97,7 +99,6 @@ export default class RedBrand extends Component { |
|
@@ -97,7 +99,6 @@ export default class RedBrand extends Component { |
97
|
if (!shopsdecorator || shopsdecorator.template_type != '1') {
|
99
|
if (!shopsdecorator || shopsdecorator.template_type != '1') {
|
98
|
result.length = headerHeight; //header
|
100
|
result.length = headerHeight; //header
|
99
|
if (countNumb == layoutIndex) {
|
101
|
if (countNumb == layoutIndex) {
|
100
|
- this.layoutLenghtOffesetForIndex['fliter' + fliter + 'row' + countNumb] = result;
|
|
|
101
|
return result;
|
102
|
return result;
|
102
|
}
|
103
|
}
|
103
|
realContainerHeight += headerHeight; //header
|
104
|
realContainerHeight += headerHeight; //header
|
|
@@ -108,7 +109,6 @@ export default class RedBrand extends Component { |
|
@@ -108,7 +109,6 @@ export default class RedBrand extends Component { |
108
|
if (countNumb == layoutIndex) {
|
109
|
if (countNumb == layoutIndex) {
|
109
|
result.offset = realContainerHeight - 44;
|
110
|
result.offset = realContainerHeight - 44;
|
110
|
result.length = 44;
|
111
|
result.length = 44;
|
111
|
- this.layoutLenghtOffesetForIndex['fliter' + fliter + 'row' + countNumb] = result;
|
|
|
112
|
return result;
|
112
|
return result;
|
113
|
}
|
113
|
}
|
114
|
let sectionDataSource = item.data;
|
114
|
let sectionDataSource = item.data;
|
|
@@ -249,7 +249,6 @@ export default class RedBrand extends Component { |
|
@@ -249,7 +249,6 @@ export default class RedBrand extends Component { |
249
|
countNumb++;
|
249
|
countNumb++;
|
250
|
}
|
250
|
}
|
251
|
if (validFloorData && countNumb == layoutIndex) {
|
251
|
if (validFloorData && countNumb == layoutIndex) {
|
252
|
- this.layoutLenghtOffesetForIndex['fliter' + fliter + 'row' + countNumb] = result;
|
|
|
253
|
return result;
|
252
|
return result;
|
254
|
}
|
253
|
}
|
255
|
}
|
254
|
}
|
|
@@ -257,12 +256,12 @@ export default class RedBrand extends Component { |
|
@@ -257,12 +256,12 @@ export default class RedBrand extends Component { |
257
|
} else if (item.key == 'productList') {
|
256
|
} else if (item.key == 'productList') {
|
258
|
let brandFilterContainerHeight = this.props.fliter == '2' ? 84 : 40;
|
257
|
let brandFilterContainerHeight = this.props.fliter == '2' ? 84 : 40;
|
259
|
countNumb++; // filter
|
258
|
countNumb++; // filter
|
|
|
259
|
+ this.productListUpOffset = realContainerHeight;
|
260
|
if (countNumb == layoutIndex) {
|
260
|
if (countNumb == layoutIndex) {
|
261
|
result = {
|
261
|
result = {
|
262
|
length: brandFilterContainerHeight,
|
262
|
length: brandFilterContainerHeight,
|
263
|
offset: realContainerHeight
|
263
|
offset: realContainerHeight
|
264
|
};
|
264
|
};
|
265
|
- this.layoutLenghtOffesetForIndex['fliter' + fliter + 'row' + countNumb] = result;
|
|
|
266
|
return result;
|
265
|
return result;
|
267
|
} else if (layoutIndex > countNumb) {
|
266
|
} else if (layoutIndex > countNumb) {
|
268
|
let rowHeight = Math.ceil(254 * width / 320);
|
267
|
let rowHeight = Math.ceil(254 * width / 320);
|
|
@@ -271,7 +270,6 @@ export default class RedBrand extends Component { |
|
@@ -271,7 +270,6 @@ export default class RedBrand extends Component { |
271
|
realContainerHeight += brandFilterContainerHeight;
|
270
|
realContainerHeight += brandFilterContainerHeight;
|
272
|
result.length = rowHeight + rowMarginTop + rowMarginBottom;
|
271
|
result.length = rowHeight + rowMarginTop + rowMarginBottom;
|
273
|
result.offset = realContainerHeight + (layoutIndex - countNumb) * result.length;
|
272
|
result.offset = realContainerHeight + (layoutIndex - countNumb) * result.length;
|
274
|
- this.layoutLenghtOffesetForIndex['fliter' + fliter + 'row' + layoutIndex] = result;
|
|
|
275
|
return result;
|
273
|
return result;
|
276
|
}
|
274
|
}
|
277
|
}
|
275
|
}
|
|
@@ -284,16 +282,21 @@ export default class RedBrand extends Component { |
|
@@ -284,16 +282,21 @@ export default class RedBrand extends Component { |
284
|
|
282
|
|
285
|
|
283
|
|
286
|
getItemLayout(data, index) {
|
284
|
getItemLayout(data, index) {
|
287
|
- let {fliter} = this.props;
|
|
|
288
|
- let key = key = 'fliter' + fliter + 'row' + index;
|
285
|
+ let {fliter,shopsdecorator} = this.props;
|
|
|
286
|
+ let key = 'fliter' + fliter + 'row' + index;
|
289
|
let sectionInfo = {
|
287
|
let sectionInfo = {
|
290
|
length: 0,
|
288
|
length: 0,
|
291
|
offset: 0,
|
289
|
offset: 0,
|
292
|
};
|
290
|
};
|
|
|
291
|
+ if (shopsdecorator.isFetching) {
|
|
|
292
|
+ sectionInfo = this._calculateSectionRealHeight(this.sectionData, index);
|
|
|
293
|
+ }else {
|
293
|
if (this.layoutLenghtOffesetForIndex[key]) {
|
294
|
if (this.layoutLenghtOffesetForIndex[key]) {
|
294
|
sectionInfo = this.layoutLenghtOffesetForIndex[key];
|
295
|
sectionInfo = this.layoutLenghtOffesetForIndex[key];
|
295
|
} else {
|
296
|
} else {
|
296
|
sectionInfo = this._calculateSectionRealHeight(this.sectionData, index);
|
297
|
sectionInfo = this._calculateSectionRealHeight(this.sectionData, index);
|
|
|
298
|
+ this.layoutLenghtOffesetForIndex[key] = sectionInfo;
|
|
|
299
|
+ }
|
297
|
}
|
300
|
}
|
298
|
return {length: sectionInfo.length, offset: sectionInfo.offset, index};
|
301
|
return {length: sectionInfo.length, offset: sectionInfo.offset, index};
|
299
|
}
|
302
|
}
|
|
@@ -307,7 +310,7 @@ export default class RedBrand extends Component { |
|
@@ -307,7 +310,7 @@ export default class RedBrand extends Component { |
307
|
if (shopsdecorator && shopsdecorator.template_type == '1') {
|
310
|
if (shopsdecorator && shopsdecorator.template_type == '1') {
|
308
|
return <View style={{height:0}}></View>;
|
311
|
return <View style={{height:0}}></View>;
|
309
|
} else {
|
312
|
} else {
|
310
|
- return (<RedBrandStoreFilter key={'sec' + sectionID} resource={fliter} onPressStoreFilter={this._onPressFilter}/>);
|
313
|
+ return (<RedBrandStoreFilter style={{zIndex: 999}} key={'sec' + sectionID} resource={fliter} onPressStoreFilter={this._onPressFilter}/>);
|
311
|
}
|
314
|
}
|
312
|
}
|
315
|
}
|
313
|
case 'productList': {
|
316
|
case 'productList': {
|
|
@@ -323,7 +326,7 @@ export default class RedBrand extends Component { |
|
@@ -323,7 +326,7 @@ export default class RedBrand extends Component { |
323
|
}
|
326
|
}
|
324
|
let brandFilterContainerHeight = this.props.fliter == '2' ? 84 : 40;
|
327
|
let brandFilterContainerHeight = this.props.fliter == '2' ? 84 : 40;
|
325
|
return (
|
328
|
return (
|
326
|
- <View key={'sec' + sectionID} style={[styles.brandFilterContainer,{height:brandFilterContainerHeight}]} onLayout={
|
329
|
+ <View key={'sec' + sectionID} style={[styles.brandFilterContainer,{height:brandFilterContainerHeight,zIndex: 999}]} onLayout={
|
327
|
(evt) => {yPosition = evt.nativeEvent.layout.y;}}>
|
330
|
(evt) => {yPosition = evt.nativeEvent.layout.y;}}>
|
328
|
{this.props.fliter != '0' ?
|
331
|
{this.props.fliter != '0' ?
|
329
|
<RedBrandStoreFilter resource={fliter} onPressStoreFilter={this._onPressFilter}/>
|
332
|
<RedBrandStoreFilter resource={fliter} onPressStoreFilter={this._onPressFilter}/>
|