...
|
...
|
@@ -26,6 +26,10 @@ const { |
|
|
Animated,
|
|
|
} = ReactNative;
|
|
|
|
|
|
let {width, height} = Dimensions.get('window');
|
|
|
let navbarHeight = (Platform.OS === 'android') ? 50 : 64;
|
|
|
let userBgHieght = Math.ceil((490 / 750) * width);
|
|
|
|
|
|
export default class User extends React.Component {
|
|
|
|
|
|
static propTypes = {
|
...
|
...
|
@@ -35,6 +39,7 @@ export default class User extends React.Component { |
|
|
backgroundImage:React.PropTypes.string,
|
|
|
nickName:React.PropTypes.string.isRequired,
|
|
|
sign: React.PropTypes.string,
|
|
|
msgCount:React.PropTypes.number,
|
|
|
}),
|
|
|
|
|
|
list: ImmutablePropTypes.listOf(
|
...
|
...
|
@@ -94,23 +99,38 @@ export default class User extends React.Component { |
|
|
|
|
|
reply: ImmutablePropTypes.listOf(
|
|
|
ImmutablePropTypes.contains({
|
|
|
reply: ImmutablePropTypes.contains({
|
|
|
headIcon: React.PropTypes.string,
|
|
|
self: ImmutablePropTypes.contains({
|
|
|
avatar: React.PropTypes.string,
|
|
|
uid: React.PropTypes.number,
|
|
|
name: React.PropTypes.string,
|
|
|
backgroundImage: React.PropTypes.string,
|
|
|
}),
|
|
|
|
|
|
replyTo: ImmutablePropTypes.contains({
|
|
|
headIcon: React.PropTypes.string,
|
|
|
createTime: React.PropTypes.string.isRequired,
|
|
|
|
|
|
replyToUser: ImmutablePropTypes.contains({
|
|
|
avatar: React.PropTypes.string,
|
|
|
uid: React.PropTypes.number,
|
|
|
name: React.PropTypes.string,
|
|
|
backgroundImage: React.PropTypes.string,
|
|
|
}),
|
|
|
|
|
|
id: React.PropTypes.number,
|
|
|
postId: React.PropTypes.number,
|
|
|
createTime: React.PropTypes.number.isRequired,
|
|
|
authorUid: React.PropTypes.number,
|
|
|
})
|
|
|
replyContent: ImmutablePropTypes.contains({
|
|
|
thumbs: ImmutablePropTypes.listOf(
|
|
|
ImmutablePropTypes.contains({
|
|
|
src: React.PropTypes.string,
|
|
|
})
|
|
|
),
|
|
|
desc: React.PropTypes.string,
|
|
|
}),
|
|
|
|
|
|
postInfo: ImmutablePropTypes.contains({
|
|
|
type:React.PropTypes.string.isRequired,
|
|
|
title:React.PropTypes.string,
|
|
|
postId:React.PropTypes.string,
|
|
|
}),
|
|
|
|
|
|
}),
|
|
|
|
|
|
),
|
|
|
|
...
|
...
|
@@ -122,7 +142,7 @@ export default class User extends React.Component { |
|
|
onPressAvatar: React.PropTypes.func,
|
|
|
onPressComment: React.PropTypes.func,
|
|
|
onPressLike: React.PropTypes.func,
|
|
|
onPressPosts: React.PropTypes.func,
|
|
|
onPressPost: React.PropTypes.func,
|
|
|
onEndReached: React.PropTypes.func,
|
|
|
onRefresh: React.PropTypes.func,
|
|
|
};
|
...
|
...
|
@@ -199,6 +219,7 @@ export default class User extends React.Component { |
|
|
}
|
|
|
|
|
|
_renderRow(rowData, sectionID, rowID, highlightRow) {
|
|
|
|
|
|
switch (sectionID) {
|
|
|
case 'userInfo':
|
|
|
return (
|
...
|
...
|
@@ -248,8 +269,8 @@ export default class User extends React.Component { |
|
|
onPressReply={(url) => {
|
|
|
this.props.onPressReply && this.props.onPressReply(url);
|
|
|
}}
|
|
|
onPressPosts={(url) => {
|
|
|
this.props.onPressPosts && this.props.onPressPosts(url);
|
|
|
onPressPost={() => {
|
|
|
this.props.onPressPosts && this.props.onPressPosts();
|
|
|
}}
|
|
|
|
|
|
/>
|
...
|
...
|
@@ -296,14 +317,23 @@ export default class User extends React.Component { |
|
|
|
|
|
_updateVerticalScrollValue(offsetY) {
|
|
|
|
|
|
this.state.scrollValueV.setValue(offsetY/150);
|
|
|
this.state.listViewMarginTop.setValue(offsetY/150);
|
|
|
let delta = userBgHieght-navbarHeight;
|
|
|
|
|
|
this.state.scrollValueV.setValue(offsetY/delta);
|
|
|
// this.state.listViewMarginTop =
|
|
|
if (offsetY >= delta) {
|
|
|
this.state.listViewMarginTop.setValue(navbarHeight);
|
|
|
} else {
|
|
|
this.state.listViewMarginTop.setValue(offsetY);
|
|
|
}
|
|
|
|
|
|
// this.state.scrollValueV.setValue(offsetY/150);
|
|
|
// this.state.listViewMarginTop.setValue(offsetY/150);
|
|
|
|
|
|
}
|
|
|
|
|
|
render() {
|
|
|
let {userInfo, list, user, endReached, isRefreshing, isLoadingMore, isFetching} = this.props;
|
|
|
|
|
|
let dataSource = {
|
|
|
userInfo: userInfo.toArray(),
|
|
|
list: list.toArray(),
|
...
|
...
|
@@ -315,6 +345,7 @@ export default class User extends React.Component { |
|
|
this.animView = c;
|
|
|
}}
|
|
|
style={{flex:1, backgroundColor: 'transparent', top: this.state.listViewTop}}
|
|
|
|
|
|
>
|
|
|
<ListView
|
|
|
ref={(c) => {
|
...
|
...
|
@@ -353,15 +384,21 @@ export default class User extends React.Component { |
|
|
/>
|
|
|
</Animated.View>
|
|
|
|
|
|
<UserNavBar scrollValue={this.state.scrollValueV} channel={this.props.channel}/>
|
|
|
<UserNavBar
|
|
|
scrollValue={this.state.scrollValueV}
|
|
|
channel={this.props.channel}
|
|
|
hasRightButton={true}
|
|
|
msgCount={this.props.profile.msgCount}
|
|
|
rightButtonClick={this.props.rightButtonClick}
|
|
|
/>
|
|
|
|
|
|
</View>
|
|
|
);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
let {width, height} = Dimensions.get('window');
|
|
|
let navbarHeight = (Platform.OS === 'android') ? 50 : 64;
|
|
|
|
|
|
|
|
|
let styles = StyleSheet.create({
|
|
|
container: {
|
...
|
...
|
|