Authored by chenl

Merge branch '5.8.0-0.44.0' of http://git.yoho.cn/mobile/YH_RNComponent into 5.8.0-0.44.0

... ... @@ -16,7 +16,7 @@ import ReactNative, {
Platform,
InteractionManager
} from 'react-native';
import immutable from 'immutable';
import Immutable from 'immutable';
import HotCategoryList from './HotCategoryList';
import HotBrandList from './HotBrandList';
import YH_Image from '../../../common/components/YH_Image';
... ... @@ -35,10 +35,48 @@ export default class CategoryBList extends Component {
this.stopPullToRefresh = this.stopPullToRefresh.bind(this);
this.dataSource = new ListView.DataSource({
rowHasChanged: (r1, r2) => !immutable.is(r1, r2)
rowHasChanged: (r1, r2) => !Immutable.is(r1, r2)
});
}
shouldComponentUpdate(nextProps){
if (Immutable.is(nextProps.categoryList, this.props.categoryList)
&& (nextProps.currentCateId==this.props.currentCateId)
&& (nextProps.currentCateValue==this.props.currentCateValue)
&& (nextProps.currentChannelValue==this.props.currentChannelValue)
&& (Immutable.is(nextProps.currentSubCateData, this.props.currentSubCateData))
&& (nextProps.contentFetching==this.props.contentFetching))
{
return false;
} else {
return true;
}
}
componentWillReceiveProps(nextProps) {
if(nextProps.currentCateId != this.props.currentCateId) {
try {
if (Platform.OS === 'ios') {
if (didTouchTime > 0) {
let nowTime = (new Date()).valueOf();
let time = nowTime - didTouchTime;
let param = {
'eid': nextProps.currentCateId + '',
'ts': didTouchTime + '',
'cts': time + '',
};
ReactNative.NativeModules.YH_CommonHelper.logPerformanceWithType('CAT_CLK', param);
}
didTouchTime = 0;
}
} catch (e) {
} finally {
}
}
}
trigggePullToRefresh(categoryId, categoryValue) {
if (Platform.OS === 'ios') {
InteractionManager.runAfterInteractions(() => {
... ... @@ -181,6 +219,8 @@ export default class CategoryBList extends Component {
return (
<TouchableOpacity activeOpacity={1} onPress={() => {
let nowTime = (new Date()).valueOf();
didTouchTime = nowTime;
this.refs.subCategoryList && this.refs.subCategoryList.scrollTo({x: 0, y: 0, animated: false});
this.props.onSelectCategory && this.props.onSelectCategory(rowData.toJS());
}}>
... ... @@ -294,6 +334,7 @@ let {width, height} = Dimensions.get('window');
const DEVICE_WIDTH_RATIO = width / 375;
let cellWidth = 78 * DEVICE_WIDTH_RATIO;
let cellPadding = ((width - 102.5 * DEVICE_WIDTH_RATIO) - cellWidth * 3) / 4;
let didTouchTime = 0;
let styles = StyleSheet.create({
container: {
... ...