Authored by Yincheng

发现好货添加loadMore

reviewed by gaijianqiu
... ... @@ -3,6 +3,7 @@
import React, {Component} from 'react';
import Immutable, {Map} from 'immutable';
import LoadingIndicator from '../../../common/components/LoadingIndicator';
import LoadMoreIndicator from '../../../common/components/LoadMoreIndicator';
import ListCell from './ListCell';
import ListBannerSwiper from './ListBannerSwiper';
... ... @@ -46,7 +47,8 @@ export default class List extends Component {
render() {
let {products, banner} = this.props.resource;
let isFetching = (products.isFetching && products.page == 0) || banner.isFetching;
let isProductListFetching = products.isFetching;
let isFetching = (isProductListFetching && products.page == 0) || banner.isFetching;
let list = products.list && products.list.toJS();
let bannerList = banner.data && banner.data.toJS();
... ... @@ -65,6 +67,22 @@ export default class List extends Component {
showsVerticalScrollIndicator={false}
dataSource={this.dataSource.cloneWithRowsAndSections(dataBlob)}
renderRow={this.renderRow}
onEndReached={() => {
if (list && list.length) {
this.props.onEndReached && this.props.onEndReached();
}
}}
renderFooter={()=>{
if (list && list.length && isProductListFetching) {
return <LoadMoreIndicator
isVisible={true}
animating={true}
/>;
} else {
return null;
}
}}
/>
:<LoadingIndicator
isVisible={isFetching}
... ...
... ... @@ -47,6 +47,7 @@ class ListContainer extends Component {
constructor(props) {
super(props);
this._onPressDetail = this._onPressDetail.bind(this);
this._onEndReached = this._onEndReached.bind(this);
}
componentDidMount() {
... ... @@ -65,12 +66,20 @@ class ListContainer extends Component {
ReactNative.NativeModules.YH_CommonHelper.pushGoodGoodsRecommendDetailWithProductSKN(product_skn + '');
}
_onEndReached() {
console.log('onasdfadfadfa');
InteractionManager.runAfterInteractions(() => {
this.props.actions.getProductList();
});
}
render() {
let {list} = this.props;
return (
<List
resource={list}
onPressDetail={this._onPressDetail}
onEndReached={this._onEndReached}
/>
);
}
... ...