|
|
'use strict';
|
|
|
|
|
|
import React, {Component} from "react";
|
|
|
import {View, Text, Image, ListView, StyleSheet, Dimensions, TouchableOpacity} from "react-native";
|
|
|
import {View, Text, Image, ListView, StyleSheet, Dimensions, TouchableOpacity, Platform} from "react-native";
|
|
|
import Immutable from "immutable";
|
|
|
import TimeForFocus from "./TimeForFocus";
|
|
|
import TimeForLostFocus from "./TimeForLostFocus";
|
...
|
...
|
@@ -41,11 +41,18 @@ export default class SeckillTimeListView extends Component { |
|
|
let scrollX;
|
|
|
let currentScrollX = this.listView ? this.listView.scrollProperties.offset : 0;
|
|
|
scrollX = (this.curFocusActivity.get('index') - 1) * (rowContainerWidth + separatorWidth);
|
|
|
if (Platform.OS == 'ios') {
|
|
|
if (scrollX < 0) {
|
|
|
scrollX = 0
|
|
|
} else if (this.listView && (scrollX > this.listView.scrollProperties.contentLength - this.listView.scrollProperties.visibleLength)) {
|
|
|
scrollX = this.listView.scrollProperties.contentLength - this.listView.scrollProperties.visibleLength
|
|
|
}
|
|
|
}
|
|
|
if (this.scrollX == scrollX && ((Math.floor(scrollX) == Math.floor(currentScrollX)) || scrollX != 0)) {
|
|
|
return;
|
|
|
}
|
|
|
this.scrollX = scrollX;
|
|
|
|
|
|
this.scrollX = scrollX;
|
|
|
this.listView && this.listView.scrollTo({x: scrollX, y: 0, animated: true});
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -178,6 +185,10 @@ export default class SeckillTimeListView extends Component { |
|
|
}
|
|
|
|
|
|
_renderSeparator(sectionID, rowID, adjacentRowHighlighted) {
|
|
|
let listLength = this.secKillProductVoList.length;
|
|
|
if (listLength - 1 == rowID) {
|
|
|
return null;
|
|
|
}
|
|
|
return (
|
|
|
<View key={'sep' + rowID} style={styles.separator}>
|
|
|
</View>
|
...
|
...
|
@@ -224,7 +235,7 @@ let backgroundHeight = 61; |
|
|
let diffTime;
|
|
|
let rowContainerWidth = Math.ceil((223 * width) / 750);
|
|
|
let rowContainerFocusWidth = Math.ceil((294 * width) / 750);
|
|
|
let separatorWidth = 1.5;
|
|
|
let separatorWidth = 1;
|
|
|
|
|
|
let styles = StyleSheet.create({
|
|
|
container: {
|
...
|
...
|
|