...
|
...
|
@@ -6,7 +6,7 @@ import ScrollableTabView, {DefaultTabBar} from 'react-native-scrollable-tab-view |
|
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
|
|
|
|
|
import UserCenterTop from './UserCenterTop';
|
|
|
import CommunityList from '../CommonComp/CommunityList';
|
|
|
import CommunityList from './CommunityList';
|
|
|
import ReplyList from './ReplyList';
|
|
|
import SectionTabBar from '../section/SectionTabBar';
|
|
|
import LoadMoreIndicator from '../../../common/components/LoadMoreIndicator';
|
...
|
...
|
@@ -173,6 +173,7 @@ export default class User extends React.Component { |
|
|
this._updateHorizontalScrollValue = this._updateHorizontalScrollValue.bind(this);
|
|
|
this._updateVerticalScrollValue = this._updateVerticalScrollValue.bind(this);
|
|
|
this._getCurrentPageHeight = this._getCurrentPageHeight.bind(this);
|
|
|
this.getPageList = this.getPageList.bind(this);
|
|
|
|
|
|
this.dataSource = new ListView.DataSource({
|
|
|
rowHasChanged: (r1, r2) => !Immutable.is(r1, r2),
|
...
|
...
|
@@ -213,43 +214,55 @@ export default class User extends React.Component { |
|
|
initialPage={this.currentPage}
|
|
|
onScroll={this._updateHorizontalScrollValue}
|
|
|
getCurrentPageHeight={this._getCurrentPageHeight}
|
|
|
prerenderingSiblingsNumber={Infinity}
|
|
|
onChangeTab={(tab) => {
|
|
|
this.currentPage = tab.i;
|
|
|
}}
|
|
|
>
|
|
|
|
|
|
<CommunityList
|
|
|
ref={(c) => {
|
|
|
this.tab1 = c;
|
|
|
}}
|
|
|
tabLabel={'posts'}
|
|
|
data={rowData.get('posts')}
|
|
|
onPressPost={this.props.onPressPost}
|
|
|
onPressAvatar={this.props.onPressAvatar}
|
|
|
onPressSectionTag={this.props.onPressSectionTag}
|
|
|
onPressComment={this.props.onPressComment}
|
|
|
onPressLike={this.props.onPressLike}
|
|
|
onContentSizeChange={(width, height) => {}}
|
|
|
page={0}
|
|
|
endReachedViewHeight={this.initialPageHeight}
|
|
|
endReached={this.props.endReached}
|
|
|
/>
|
|
|
|
|
|
<CommunityList
|
|
|
ref={(c) => {
|
|
|
this.tab2 = c;
|
|
|
}}
|
|
|
tabLabel={'like'}
|
|
|
data={rowData.get('like')}
|
|
|
onPressPost={this.props.onPressPost}
|
|
|
onPressAvatar={this.props.onPressAvatar}
|
|
|
onPressSectionTag={this.props.onPressSectionTag}
|
|
|
onPressComment={this.props.onPressComment}
|
|
|
onPressLike={this.props.onPressLike}
|
|
|
onContentSizeChange={(width, height) => {}}
|
|
|
page={1}
|
|
|
endReachedViewHeight={this.initialPageHeight}
|
|
|
endReached={this.props.endReached}
|
|
|
/>
|
|
|
|
|
|
<ReplyList
|
|
|
ref={(c) => {
|
|
|
this.tab3 = c;
|
|
|
}}
|
|
|
tabLabel={'reply'}
|
|
|
data={rowData.get('reply')}
|
|
|
onPressAvatar={this.props.onPressAvatar}
|
|
|
onPressReply={this.props.onPressReply}
|
|
|
onPressPost={this.props.onPressPost}
|
|
|
onContentSizeChange={(width, height) => {}}
|
|
|
endReached={this.props.endReached}
|
|
|
endReachedViewHeight={this.initialPageHeight}
|
|
|
/>
|
|
|
|
|
|
</ScrollableTabView>
|
...
|
...
|
@@ -320,9 +333,29 @@ export default class User extends React.Component { |
|
|
}
|
|
|
|
|
|
let height = ref.state.contentHeight;
|
|
|
|
|
|
let item = this.getPageList(this.currentPage);
|
|
|
if (item.size == 0) {
|
|
|
height = height == 0 ? this.initialPageHeight : height;
|
|
|
}
|
|
|
|
|
|
return height;
|
|
|
}
|
|
|
|
|
|
getPageList(page) {
|
|
|
let item;
|
|
|
let list = this.props.list;
|
|
|
if (page == 0) {
|
|
|
item = list.get(0).get('posts');
|
|
|
} else if (page == 1) {
|
|
|
item = list.get(0).get('like');
|
|
|
} else {
|
|
|
item = list.get(0).get('reply');
|
|
|
}
|
|
|
|
|
|
return item;
|
|
|
}
|
|
|
|
|
|
render() {
|
|
|
let {userInfo, list, endReached, isRefreshing, isLoadingMore, isFetching, endReachedText} = this.props;
|
|
|
let dataSource = {
|
...
|
...
|
@@ -330,6 +363,9 @@ export default class User extends React.Component { |
|
|
list: list.toArray(),
|
|
|
};
|
|
|
|
|
|
let item = this.getPageList(this.currentPage);
|
|
|
let visible = item.size != 0;
|
|
|
|
|
|
return (
|
|
|
<View style={styles.container}>
|
|
|
<ListView
|
...
|
...
|
@@ -351,8 +387,9 @@ export default class User extends React.Component { |
|
|
}}
|
|
|
renderFooter={() => {
|
|
|
if (endReached) {
|
|
|
return <EmptyListTip
|
|
|
text={endReachedText}
|
|
|
return <LoadMoreIndicator
|
|
|
isVisible={visible}
|
|
|
text={'暂无更多'}
|
|
|
/>
|
|
|
} else {
|
|
|
return <LoadMoreIndicator
|
...
|
...
|
|