Authored by LakeR

修复bug: 自动滑动至选中位置 review by chenlin

'use strict';
import React, {Component} from 'react';
import ReactNative, {
View,
Text,
Image,
ListView,
StyleSheet,
Dimensions,
TouchableOpacity,
} from 'react-native';
import Immutable, {Map} from 'immutable';
import TimeForFocus from './TimeForFocus';
import TimeForLostFocus from './TimeForLostFocus';
import React, {Component} from "react";
import {View, Text, Image, ListView, StyleSheet, Dimensions, TouchableOpacity} from "react-native";
import Immutable from "immutable";
import TimeForFocus from "./TimeForFocus";
import TimeForLostFocus from "./TimeForLostFocus";
let diff;
... ... @@ -46,9 +38,10 @@ export default class SeckillTimeListView extends Component {
//focus
if (this.secKillProductVoList.length >= 1) {
let listLength = this.secKillProductVoList.length;
let scrollX = 0;
let scrollX;
let currentScrollX = this.listView ? this.listView.scrollProperties.offset : 0;
scrollX = (this.curFocusActivity.get('index') - 1) * (rowContainerWidth + separatorWidth);
if (this.scrollX == scrollX) {
if (this.scrollX == scrollX && ((Math.floor(scrollX) == Math.floor(currentScrollX)) || scrollX != 0)) {
return;
}
this.scrollX = scrollX;
... ... @@ -56,15 +49,16 @@ export default class SeckillTimeListView extends Component {
this.listView && this.listView.scrollTo({x: scrollX, y: 0, animated: true});
}
}
_searchRightNowStartActivity() {
this.secKillProductVoList.forEach((activityItem, i) => {
if (activityItem.has('wait')) {
let nowTime = Date.parse(new Date()) / 1000 + diffTime;
let startTime = activityItem.get('startTime')/1000;
let startTime = activityItem.get('startTime') / 1000;
let offsetTime = startTime - nowTime;
if (offsetTime < 0) {
activityItem.focus = true;
this.curFocusActivity= activityItem;
this.curFocusActivity = activityItem;
this._scrollToFocusActivity();
this.props.onFocusToCurStartedActivity && this.props.onFocusToCurStartedActivity(activityItem);
}
... ...