...
|
...
|
@@ -36,6 +36,7 @@ export default class BrandStore extends Component { |
|
|
this.renderSectionHeader = this.renderSectionHeader.bind(this);
|
|
|
this.renderRow = this.renderRow.bind(this);
|
|
|
this._onPressProductFilter = this._onPressProductFilter.bind(this);
|
|
|
this._onPressStoreFilter = this._onPressStoreFilter.bind(this);
|
|
|
|
|
|
this.dataSource = new ListView.DataSource({
|
|
|
rowHasChanged: (r1, r2) => !Immutable.is(r1, r2),
|
...
|
...
|
@@ -50,17 +51,26 @@ export default class BrandStore extends Component { |
|
|
this._showToast && this._showToast(showToastMessage);
|
|
|
}
|
|
|
}
|
|
|
_onPressProductFilter(value){
|
|
|
|
|
|
_onPressStoreFilter(value){
|
|
|
this.props.onPressStoreFilter && this.props.onPressStoreFilter(value);
|
|
|
if (value != 3) {
|
|
|
if (value == 0) {
|
|
|
this.refs.brandStoreList && this.refs.brandStoreList.scrollTo({x: 0, y: Math.ceil((200 / 640) * width), animated: false});
|
|
|
}else {
|
|
|
this.refs.brandStoreList && this.refs.brandStoreList.scrollTo({x: 0, y: storeFilter_y_Position, animated: false});
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
_onPressProductFilter(value){
|
|
|
if(value === 'filter'){
|
|
|
this.refs.brandStoreList && this.refs.brandStoreList.scrollTo({x: 0, y: yPosition, animated: false});
|
|
|
}
|
|
|
if(value==='default'){
|
|
|
this.refs.brandStoreList && this.refs.brandStoreList.scrollTo({x: 0, y: yPosition, animated: false});
|
|
|
|
|
|
}
|
|
|
this.props.onPressProductFilter && this.props.onPressProductFilter(value);
|
|
|
|
|
|
}
|
|
|
|
|
|
_showToast(message){
|
...
|
...
|
@@ -70,36 +80,39 @@ export default class BrandStore extends Component { |
|
|
duration: 255,
|
|
|
children: message,
|
|
|
animationEnd : () => {
|
|
|
this._toast && this._toast._toastAnimationToggle = setTimeout(
|
|
|
() => {
|
|
|
this._toast && this._toast.hide({
|
|
|
duration: 0,
|
|
|
animationEnd: () => {
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
1000
|
|
|
);
|
|
|
if(this._toast){
|
|
|
this._toast._toastAnimationToggle = setTimeout(
|
|
|
() => {
|
|
|
this._toast && this._toast.hide({
|
|
|
duration: 0,
|
|
|
animationEnd: () => {
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
1000
|
|
|
);
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
|
|
|
renderSectionHeader(sectionData, sectionID) {
|
|
|
switch(sectionID) {
|
|
|
case 'brandReource': {
|
|
|
return (
|
|
|
<BrandStoreFilter
|
|
|
selectID={this.props.storeFilter}
|
|
|
onPressFilter={this.props.onPressStoreFilter}
|
|
|
/>
|
|
|
);
|
|
|
}
|
|
|
case 'brandReource':
|
|
|
case 'storeFilter': {
|
|
|
|
|
|
return (
|
|
|
<BrandStoreFilter
|
|
|
selectID={this.props.storeFilter}
|
|
|
onPressFilter={this.props.onPressStoreFilter}
|
|
|
/>
|
|
|
<View
|
|
|
style={styles.brandFilterContainer}
|
|
|
onLayout={(evt) => {
|
|
|
storeFilter_y_Position = evt.nativeEvent.layout.y;
|
|
|
}}
|
|
|
>
|
|
|
<BrandStoreFilter
|
|
|
selectID={this.props.storeFilter}
|
|
|
onPressFilter={this._onPressStoreFilter}
|
|
|
/>
|
|
|
</View>
|
|
|
);
|
|
|
}
|
|
|
case 'productList': {
|
...
|
...
|
@@ -357,6 +370,7 @@ let rowHeight = Math.ceil(254 * width / 320); |
|
|
let rowMarginTop = Math.ceil(10 * width / 320);
|
|
|
let rowMarginHorizontal = (width - rowWidth * 2) / 3;
|
|
|
let yPosition = 0;
|
|
|
let storeFilter_y_Position = 0;
|
|
|
|
|
|
let styles = StyleSheet.create({
|
|
|
container: {
|
...
|
...
|
|