...
|
...
|
@@ -21,6 +21,7 @@ import TimeListView from "./TimeListView"; |
|
|
import Prompt from "../../../coupon/components/coupon/Prompt";
|
|
|
import YH_PtrRefresh from "../../../common/components/YH_PtrRefresh";
|
|
|
import ProductListCell from "../../../common/components/ListCell/ProductListCell";
|
|
|
import LoadingIndicator from '../../../common/components/LoadingIndicator';
|
|
|
|
|
|
const SECTION_TYPE_SECKILL = 1;
|
|
|
const SECTION_TYPE_DISCOUNT = 2;
|
...
|
...
|
@@ -42,10 +43,10 @@ export default class Seckill extends Component { |
|
|
|
|
|
componentDidMount() {
|
|
|
if (Platform.OS === 'ios') {
|
|
|
this.timer = TimerMixin.setTimeout(() => {
|
|
|
this.listView && this.listView.getScrollResponder().startPullToRefresh();
|
|
|
}, 0);
|
|
|
|
|
|
// this.timer = TimerMixin.setTimeout(() => {
|
|
|
// this.listView && this.listView.getScrollResponder().startPullToRefresh();
|
|
|
// }, 0);
|
|
|
this.props.onRefresh && this.props.onRefresh();
|
|
|
} else {
|
|
|
this.props.onRefresh && this.props.onRefresh();
|
|
|
}
|
...
|
...
|
@@ -117,6 +118,7 @@ export default class Seckill extends Component { |
|
|
<ProductListView
|
|
|
key={index}
|
|
|
rowData={item}
|
|
|
onPressGuangShopWithURL={this.props.onPressGuangShopWithURL}
|
|
|
onPressProductItem={this.props.onPressProductItem}
|
|
|
onPressRemindBtn={this.props.onPressRemindBtn}
|
|
|
tipMessage={this.tipMessage}
|
...
|
...
|
@@ -128,8 +130,19 @@ export default class Seckill extends Component { |
|
|
|
|
|
|
|
|
renderDiscountProduct({item, index}) {
|
|
|
|
|
|
let paddingLeft = index % 2 === 1 ? rowMarginHorizontal / 2 : rowMarginHorizontal;
|
|
|
let customStyle = index === 0 || index === 1 ? {
|
|
|
paddingLeft
|
|
|
} : {
|
|
|
paddingLeft
|
|
|
};
|
|
|
|
|
|
return <ProductListCell
|
|
|
style={styles.listContainer}
|
|
|
style={
|
|
|
[styles.listContainer, customStyle]
|
|
|
}
|
|
|
key={'row' + index}
|
|
|
rowID={index}
|
|
|
data={item}
|
...
|
...
|
@@ -139,6 +152,7 @@ export default class Seckill extends Component { |
|
|
renderDiscountSection({item}) {
|
|
|
return <FlatList
|
|
|
data={item}
|
|
|
style={{backgroundColor:'white'}}
|
|
|
numColumns={2}
|
|
|
renderItem={this.renderDiscountProduct}
|
|
|
/>
|
...
|
...
|
@@ -166,17 +180,12 @@ export default class Seckill extends Component { |
|
|
return (
|
|
|
<View style={styles.container}>
|
|
|
<SectionList
|
|
|
refreshControl={Platform.OS === 'ios' ? null : <YH_PtrRefresh
|
|
|
refreshing={isPullToRefresh}
|
|
|
onRefresh={() =>this.props.onRefresh && this.props.onRefresh()}
|
|
|
/>}
|
|
|
renderItem={this.renderItem}
|
|
|
contentContainerStyle={styles.contentContainer}
|
|
|
ListHeaderComponent={this.renderListHeaderComponent}
|
|
|
renderSectionFooter={this.renderSectionFooter}
|
|
|
renderSectionHeader={this.renderSectionHeader}
|
|
|
enablePullToRefresh={true}
|
|
|
isOnPullToRefresh={isPullToRefresh}
|
|
|
stickySectionHeadersEnabled={false}
|
|
|
onRefreshData={() => this.props.onRefresh && this.props.onRefresh()}
|
|
|
sections={[
|
|
|
{title: null, type: SECTION_TYPE_SECKILL, data: queryProductList ? queryProductList : []},
|
...
|
...
|
@@ -188,6 +197,7 @@ export default class Seckill extends Component { |
|
|
},
|
|
|
]}
|
|
|
/>
|
|
|
<LoadingIndicator isVisible={isPullToRefresh} />
|
|
|
{tipMessage != '' ?
|
|
|
<Prompt
|
|
|
text={tipMessage}
|
...
|
...
|
@@ -205,6 +215,8 @@ export default class Seckill extends Component { |
|
|
}
|
|
|
let {width, height} = Dimensions.get('window');
|
|
|
let diff = 0;
|
|
|
let rowWidth = Math.ceil(137.5 * width / 320);
|
|
|
let rowMarginHorizontal = (width - rowWidth * 2) / 3;
|
|
|
|
|
|
let styles = StyleSheet.create({
|
|
|
container: {
|
...
|
...
|
|