Authored by 于良

个人中心bug fix review by 盖剑秋

... ... @@ -302,7 +302,10 @@ const ScrollableTabView = React.createClass({
};
}
let heightStyle = this.state.currentPageContentHeight ? {height: this.state.currentPageContentHeight} : null;
let heightStyle = null;
if (this.state.currentPageContentHeight) {
heightStyle = {height: this.state.currentPageContentHeight};
}
return <View style={[styles.container, heightStyle, this.props.style, ]} onLayout={this._handleLayout}>
{this.props.tabBarPosition === 'top' && this.renderTabBar(tabBarProps)}
... ...
... ... @@ -272,7 +272,7 @@ export default class User extends React.Component {
<SectionTabBar
style={{borderBottomWidth: 0.5, borderBottomColor: '#e0e0e0',}}
tabs={this.tabs}
activeTab={this.state.currentPage}
activeTab={this.currentPage}
scrollValue={this.state.scrollValueH}
goToPage={(page) => this._goToPage(page)}
/>
... ... @@ -321,30 +321,12 @@ export default class User extends React.Component {
}
render() {
let {userInfo, list, endReached, isRefreshing, isLoadingMore, isFetching} = this.props;
let {userInfo, list, endReached, isRefreshing, isLoadingMore, isFetching, endReachedText} = this.props;
let dataSource = {
userInfo: userInfo.toArray(),
list: list.toArray(),
};
let endReachedText = '暂无更多';
if (this.currentPage == 0) {
let items = list.get(0).get('posts');
if (items.size == 0) {
endReachedText = '你还没有发布的帖子';
}
} else if (this.currentPage == 1) {
let items = list.get(0).get('like');
if (items.size == 0) {
endReachedText = '你还没有赞过的帖子';
}
} else if (this.currentPage == 2) {
let items = list.get(0).get('reply');
if (items.size == 0) {
endReachedText = '你还没有回复过的帖子';
}
}
return (
<View style={styles.container}>
<ListView
... ...
... ... @@ -241,19 +241,29 @@ class UserContainer extends React.Component {
let isRefreshing = ptr;
let userInfo = Immutable.fromJS([profile]);
let isLoadingMore, endReached;
let endReachedText = '暂无更多';
if (activeTab === 0) {
isLoadingMore = !ptr && postsData.isFetching;
isFetching = postsData.isFetching;
endReached = postsData.endReached;
if (postsData.list.size == 0) {
endReachedText = '你还没有发布的帖子';
}
} else if (activeTab === 1) {
isLoadingMore = !ptr && likeData.isFetching;
isFetching = likeData.isFetching;
endReached = likeData.endReached;
if (likeData.list.size == 0) {
endReachedText = '你还没有赞过的帖子';
}
} else if (activeTab === 2) {
isLoadingMore = !ptr && replyData.isFetching;
isFetching = replyData.isFetching;
endReached = replyData.endReached;
if (replyData.list.size == 0) {
endReachedText = '你还没有回复过的帖子';
}
}
return (
... ... @@ -278,7 +288,10 @@ class UserContainer extends React.Component {
isRefreshing={isRefreshing}
isLoadingMore={isLoadingMore}
onEndReached={this._onEndReached}
onChangeTab={this._onChangeTab}
rightButtonClick={this._rightButtonClick}
endReachedText={endReachedText}
activeTab={activeTab}
/>
</View>
);
... ...