Authored by 孙凯

add 活动楼层 review by zhanglixia

'use strict';
import React from 'react';
import ReactNative from 'react-native';
import Immutable, {Map} from 'immutable';
import YH_Image from '../../../common/components/YH_Image';
import {getSlicedUrl} from '../../../classify/utils/Utils';
const {
View,
Text,
TouchableOpacity,
Dimensions,
StyleSheet,
Platform,
} = ReactNative;
export default class ActivityCell extends React.Component {
constructor(props) {
super (props);
}
shouldComponentUpdate(nextProps,nextState){
if (Immutable.is(nextProps.resource, this.props.resource)) {
return false;
} else {
return true;
}
}
render() {
let {resource} = this.props;
if (!resource) {
return null;
}
let data = resource.toJS();
let newSrc = getSlicedUrl(data.coverUrl, backgroundWidth, backgroundHeight);
return (
<View style={styles.container}>
<TouchableOpacity
activeOpacity={1}
style={{width: backgroundWidth, height: backgroundHeight}}
onPress={() => {
this.props.onPressProduct && this.props.onPressProduct();
}}
>
<YH_Image
url={newSrc}
style={{ width: backgroundWidth, height: backgroundHeight}}
/>
</TouchableOpacity>
<View style={styles.space} />
</View>
);
}
}
let {width, height} = Dimensions.get('window');
let backgroundWidth = width;
let backgroundHeight = Math.ceil((300 / 640) * width);
let spaceH = Math.ceil((30 / 640) * width);
let styles = StyleSheet.create({
container: {
width: width,
height: backgroundHeight + spaceH,
},
space: {
width: width,
height: spaceH,
backgroundColor: 'white',
},
});
... ...
... ... @@ -20,7 +20,7 @@ import OutletThreeImage from './OutletThreeImage';
import OutletRecommendFive from './OutletRecommendFive';
import ProductFliter from './ProductFliter';
import BrandProductListCell from '../../../common/components/ListCell/ProductListCell';
import ActivityCell from './ActivityCell';
export default class OutletPageListView extends Component {
constructor(props) {
... ... @@ -88,7 +88,7 @@ export default class OutletPageListView extends Component {
// return(<TripleImage resource={rowData} onPressProduct={this.props.onPressProduct}/>);
}
}else if (sectionID == 'activityList') {
return(<ActivityCell resource={rowData} onPressProduct={this.props.onPressProduct}/>);
}else if (sectionID == 'categoryNavigationList') {
let paddingLeft = rowID % 2 == 1 ? rowMarginHorizontal / 2 : rowMarginHorizontal;
... ...