...
|
...
|
@@ -49,6 +49,7 @@ import ActivityProductFloor from '../floor/ActivityProductFloor'; |
|
|
import HotCategoryIndividualization from '../floor/HotCategoryIndividualization';
|
|
|
import ProductListCell from '../../../common/components/ListCell/ProductListCell';
|
|
|
import RecommendPopView from './RecommendPopView';
|
|
|
import NetWorkView from './NetWorkView';
|
|
|
|
|
|
|
|
|
export default class Home extends Component {
|
...
|
...
|
@@ -479,9 +480,11 @@ export default class Home extends Component { |
|
|
render() {
|
|
|
let channel = this.props.channel;
|
|
|
let data = this._currentChannelData();
|
|
|
let {isFetching, recommendProduct} = data;
|
|
|
let {isFetching, recommendProduct, list, cached, isFirstLoad} = data;
|
|
|
let dataSource = floorParser.homeDataParse(data, channel);
|
|
|
|
|
|
let floorList = list.size > 0 ? list.toArray() : cached.get('list').toArray();
|
|
|
|
|
|
let isPullToRefresh = isFetching;
|
|
|
|
|
|
let recommendData = recommendProduct.get('list').toArray();
|
...
|
...
|
@@ -493,90 +496,100 @@ export default class Home extends Component { |
|
|
recommendVisible = false;
|
|
|
}
|
|
|
|
|
|
let isShowEmpty = floorList.size === 0 && !isFirstLoad;
|
|
|
let isShowWait = isShowEmpty && isFetching;
|
|
|
return (
|
|
|
<View style={styles.container}>
|
|
|
{
|
|
|
Platform.OS === 'ios' ?
|
|
|
<ListView
|
|
|
ref={(c) => {
|
|
|
this.listView = c;
|
|
|
}}
|
|
|
contentContainerStyle={styles.contentContainer}
|
|
|
dataSource={this.dataSource.cloneWithRowsAndSections(dataSource)}
|
|
|
renderRow={this._renderRow}
|
|
|
renderSectionHeader={this._renderSectionHeader}
|
|
|
removeClippedSubviews={true}
|
|
|
enableEmptySections={true}
|
|
|
enablePullToRefresh={true}
|
|
|
isOnPullToRefresh={isPullToRefresh}
|
|
|
onRefreshData={() => {
|
|
|
this.props.onRefresh && this.props.onRefresh();
|
|
|
}}
|
|
|
onEndReached={() => {
|
|
|
this.props.onEndReached && this.props.onEndReached();
|
|
|
}}
|
|
|
renderFooter={this._renderFooter}
|
|
|
onScroll={this._onScroll}
|
|
|
/>
|
|
|
:
|
|
|
<ListView
|
|
|
ref={(c) => {
|
|
|
this.listView = c;
|
|
|
}}
|
|
|
contentContainerStyle={styles.contentContainer}
|
|
|
dataSource={this.dataSource.cloneWithRowsAndSections(dataSource)}
|
|
|
renderRow={this._renderRow}
|
|
|
renderSectionHeader={this._renderSectionHeader}
|
|
|
removeClippedSubviews={true}
|
|
|
enableEmptySections={true}
|
|
|
enablePullToRefresh={true}
|
|
|
isOnPullToRefresh={isPullToRefresh}
|
|
|
initialListSize={30}
|
|
|
pageSize={30}
|
|
|
refreshControl={
|
|
|
<RefreshControl
|
|
|
refreshing={isPullToRefresh}
|
|
|
onRefresh={() => {
|
|
|
this.props.onRefresh && this.props.onRefresh();
|
|
|
}}
|
|
|
colors={['#000000', '#ff0000']}
|
|
|
progressBackgroundColor="#ffffff"
|
|
|
/>
|
|
|
}
|
|
|
onEndReached={() => {
|
|
|
this.props.onEndReached && this.props.onEndReached();
|
|
|
}}
|
|
|
renderFooter={this._renderFooter}
|
|
|
onScroll={this._onScroll}
|
|
|
/>
|
|
|
}
|
|
|
|
|
|
<RecommendPopView
|
|
|
data={recommendData}
|
|
|
isVisible={recommendVisible}
|
|
|
onPress={()=>{
|
|
|
this._autoScrollToProductList();
|
|
|
}}
|
|
|
|
|
|
isShowEmpty ?
|
|
|
<NetWorkView
|
|
|
onPress={this.props.onPressReloadData}
|
|
|
showWait={isShowWait}
|
|
|
/>
|
|
|
:
|
|
|
<View style={styles.container}>
|
|
|
{
|
|
|
Platform.OS === 'ios' ?
|
|
|
<ListView
|
|
|
ref={(c) => {
|
|
|
this.listView = c;
|
|
|
}}
|
|
|
contentContainerStyle={styles.contentContainer}
|
|
|
dataSource={this.dataSource.cloneWithRowsAndSections(dataSource)}
|
|
|
renderRow={this._renderRow}
|
|
|
renderSectionHeader={this._renderSectionHeader}
|
|
|
removeClippedSubviews={true}
|
|
|
enableEmptySections={true}
|
|
|
enablePullToRefresh={true}
|
|
|
isOnPullToRefresh={isPullToRefresh}
|
|
|
onRefreshData={() => {
|
|
|
this.props.onRefresh && this.props.onRefresh();
|
|
|
}}
|
|
|
onEndReached={() => {
|
|
|
this.props.onEndReached && this.props.onEndReached();
|
|
|
}}
|
|
|
renderFooter={this._renderFooter}
|
|
|
onScroll={this._onScroll}
|
|
|
/>
|
|
|
:
|
|
|
<ListView
|
|
|
ref={(c) => {
|
|
|
this.listView = c;
|
|
|
}}
|
|
|
contentContainerStyle={styles.contentContainer}
|
|
|
dataSource={this.dataSource.cloneWithRowsAndSections(dataSource)}
|
|
|
renderRow={this._renderRow}
|
|
|
renderSectionHeader={this._renderSectionHeader}
|
|
|
removeClippedSubviews={true}
|
|
|
enableEmptySections={true}
|
|
|
enablePullToRefresh={true}
|
|
|
isOnPullToRefresh={isPullToRefresh}
|
|
|
initialListSize={30}
|
|
|
pageSize={30}
|
|
|
refreshControl={
|
|
|
<RefreshControl
|
|
|
refreshing={isPullToRefresh}
|
|
|
onRefresh={() => {
|
|
|
this.props.onRefresh && this.props.onRefresh();
|
|
|
}}
|
|
|
colors={['#000000', '#ff0000']}
|
|
|
progressBackgroundColor="#ffffff"
|
|
|
/>
|
|
|
}
|
|
|
onEndReached={() => {
|
|
|
this.props.onEndReached && this.props.onEndReached();
|
|
|
}}
|
|
|
renderFooter={this._renderFooter}
|
|
|
onScroll={this._onScroll}
|
|
|
/>
|
|
|
}
|
|
|
|
|
|
{
|
|
|
this.state.showBackTop ?
|
|
|
<TouchableOpacity
|
|
|
activeOpacity={1}
|
|
|
onPress={() =>{
|
|
|
this._backTop();
|
|
|
<RecommendPopView
|
|
|
data={recommendData}
|
|
|
isVisible={recommendVisible}
|
|
|
onPress={()=>{
|
|
|
this._autoScrollToProductList();
|
|
|
}}
|
|
|
>
|
|
|
<Image
|
|
|
style={styles.backTop}
|
|
|
source={require('../../images/backToTop.png')}
|
|
|
/>
|
|
|
</TouchableOpacity>
|
|
|
:
|
|
|
<View/>
|
|
|
}
|
|
|
/>
|
|
|
|
|
|
{
|
|
|
this.state.showBackTop ?
|
|
|
<TouchableOpacity
|
|
|
activeOpacity={1}
|
|
|
onPress={() =>{
|
|
|
this._backTop();
|
|
|
}}
|
|
|
>
|
|
|
<Image
|
|
|
style={styles.backTop}
|
|
|
source={require('../../images/backToTop.png')}
|
|
|
/>
|
|
|
</TouchableOpacity>
|
|
|
:
|
|
|
<View/>
|
|
|
}
|
|
|
|
|
|
</View>
|
|
|
|
|
|
</View>
|
|
|
);
|
|
|
}
|
|
|
}
|
...
|
...
|
|