...
|
...
|
@@ -6,6 +6,7 @@ import LoadingIndicator from '../../../common/components/LoadingIndicator'; |
|
|
import LoadMoreIndicator from '../../../common/components/LoadMoreIndicator';
|
|
|
import ListCell from './ListCell';
|
|
|
import ListBannerSwiper from './ListBannerSwiper';
|
|
|
import YH_PtrRefresh from '../../../common/components/YH_PtrRefresh';
|
|
|
|
|
|
import ReactNative, {
|
|
|
View,
|
...
|
...
|
@@ -17,6 +18,7 @@ import ReactNative, { |
|
|
TouchableOpacity,
|
|
|
InteractionManager,
|
|
|
Platform,
|
|
|
RefreshControl,
|
|
|
} from 'react-native';
|
|
|
|
|
|
|
...
|
...
|
@@ -45,6 +47,7 @@ export default class List extends Component { |
|
|
return null;
|
|
|
}
|
|
|
|
|
|
|
|
|
render() {
|
|
|
let {products, banner} = this.props.resource;
|
|
|
let isProductListFetching = products.isFetching;
|
...
|
...
|
@@ -65,7 +68,8 @@ export default class List extends Component { |
|
|
|
|
|
return (
|
|
|
<View style={styles.container}>
|
|
|
{!isFetching?
|
|
|
{
|
|
|
Platform.OS === 'ios' ?
|
|
|
<ListView
|
|
|
contentContainerStyle={styles.contentContainer}
|
|
|
enableEmptySections={true}
|
...
|
...
|
@@ -93,9 +97,40 @@ export default class List extends Component { |
|
|
}
|
|
|
}}
|
|
|
/>
|
|
|
:<LoadingIndicator
|
|
|
isVisible={isFetching}
|
|
|
/>}
|
|
|
: <ListView
|
|
|
contentContainerStyle={styles.contentContainer}
|
|
|
enableEmptySections={true}
|
|
|
showsVerticalScrollIndicator={false}
|
|
|
dataSource={this.dataSource.cloneWithRowsAndSections(dataBlob)}
|
|
|
renderRow={this.renderRow}
|
|
|
enablePullToRefresh={true}
|
|
|
refreshControl={
|
|
|
<YH_PtrRefresh
|
|
|
refreshing={isFetching}
|
|
|
onRefresh={() => {
|
|
|
this.props.onRefresh && this.props.onRefresh();
|
|
|
}}
|
|
|
/>
|
|
|
}
|
|
|
|
|
|
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;
|
|
|
}
|
|
|
}}
|
|
|
/>
|
|
|
|
|
|
}
|
|
|
</View>
|
|
|
);
|
|
|
}
|
...
|
...
|
|