Authored by shangjf

rn

首页 逻辑优化 review by 于良
... ... @@ -37,9 +37,10 @@ export default class RecommendContentThree extends React.Component {
let data = list.toArray();
let lineNumber = parseInt((data.length + 3) / 4);
let listHeight = Math.floor(lineNumber * imageHeight);
let containerHeight = bannerHeight + listHeight
return (
<View style={styles.container}>
<View style={[styles.container, {height: containerHeight}]}>
<ImageSlider
resource={big_image}
sliderWidth={width}
... ... @@ -68,7 +69,7 @@ export default class RecommendContentThree extends React.Component {
<View style={styles.hLine1} />
<View style={styles.hLine2} />
</View>
</View>
);
}
... ...
... ... @@ -404,15 +404,24 @@ export default class Home extends Component {
_renderFooter() {
let data = this._currentChannelData();
let {isFetching, endReached, list, cached} = data;
let {isFetching, endReached, list, cached, favorite, isListFetching} = data;
let floorList = list.size > 0 ? list.toArray() : cached.get('list').toArray();
let isLoadingMore = !endReached && floorList.length != 0;
let isLoadingMore = false;
let animated = false;
if (this.props.channel == 4) {
isLoadingMore = !endReached && floorList.length != 0 && isListFetching;
animated = isListFetching;
} else {
isLoadingMore = !endReached && floorList.length != 0 && favorite.get('isFetching');
animated = favorite.get('isFetching');
}
return (
<LoadMoreIndicator
isVisible={isLoadingMore}
animating={isFetching}
animating={animated}
/>
);
}
... ...
... ... @@ -63,18 +63,18 @@ const DEVICE_WIDTH_RATIO = width / 375;
let styles = StyleSheet.create({
container: {
position: 'absolute',
left: 0,
left: 12*DEVICE_WIDTH_RATIO,
right: 12*DEVICE_WIDTH_RATIO,
bottom: 15*DEVICE_WIDTH_RATIO,
width,
width: width-24*DEVICE_WIDTH_RATIO,
height: 58*DEVICE_WIDTH_RATIO,
flex: 1,
flexDirection: 'row',
backgroundColor: 'transparent',
},
bgImage: {
position: 'absolute',
width,
width: width-24*DEVICE_WIDTH_RATIO,
height: 58*DEVICE_WIDTH_RATIO,
backgroundColor: 'transparent',
},
... ... @@ -84,7 +84,7 @@ let styles = StyleSheet.create({
width: 34*DEVICE_WIDTH_RATIO,
height: 44*DEVICE_WIDTH_RATIO,
alignSelf: 'center',
backgroundColor: 'red'
backgroundColor: 'transparent'
},
titleContainer: {
... ... @@ -106,6 +106,6 @@ let styles = StyleSheet.create({
downIcon: {
alignSelf: 'center',
marginLeft: 80*DEVICE_WIDTH_RATIO,
marginLeft: 50*DEVICE_WIDTH_RATIO,
},
})
... ...
... ... @@ -208,7 +208,8 @@ export function fetchBoyGirlFavoriteList() {
payload.list = newList;
}
//商品列表最多分四页
payload.endReached = (payload.currentPage > 4) || (payload.currentPage == payload.pageCount);
payload.endReached = (payload.list.length == 0)||((payload.currentPage > 4) || (payload.currentPage == payload.pageCount));
dispatch(fetchFavoriteSuccess(payload, channelStr));
... ... @@ -448,7 +449,7 @@ export function favoriteOperation(shopId) {
ReactNative.NativeModules.YH_CommonHelper.uid()
.then(uid => {
shopId = shopId + '';
let {app, home} = getState();
let channelStr = channelTransfer.number2String(app.channel);
let shopState = home[channelStr].shop.get('list');
... ...