Authored by 于良

Merge branch 'classify' of http://git.yoho.cn/mobile/YH_RNComponent into classify

... ... @@ -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: {
... ...
... ... @@ -74,7 +74,7 @@ export default class CouponCell extends React.Component {
moneySize = {fontSize:25};
name = {marginLeft: 10,marginTop: 1,width: 80,height: 30};
nameSize = {fontSize:9};
statesTitleStyle = {alignItems:'center',marginTop: 5,width: cellUpOneBack,height: 30};
statesTitleStyle = {alignItems:'center',marginTop: 5,width: cellUpOneBack,height: 60};
states = {marginTop: rowData.status?6:10,fontSize:9,width: 10,height: 60};
}
... ...