...
|
...
|
@@ -7,10 +7,12 @@ import { |
|
|
ListView,
|
|
|
StyleSheet,
|
|
|
Image,
|
|
|
Dimensions,
|
|
|
} from 'react-native'
|
|
|
import UserBrief from '../home/UserBrief';
|
|
|
|
|
|
import SubjectContent from './SubjectContent'
|
|
|
import LoadMoreIndicator from '../../../common/components/LoadMoreIndicator';
|
|
|
|
|
|
export default class SubjectPost extends Component {
|
|
|
constructor(props) {
|
...
|
...
|
@@ -31,7 +33,7 @@ export default class SubjectPost extends Component { |
|
|
<UserBrief
|
|
|
avatar={rowData.headIcon}
|
|
|
name={rowData.nickName}
|
|
|
timeago={this.props.timeagoStr}
|
|
|
timeago={rowData.timeago}
|
|
|
isOwner={rowData.LZ}
|
|
|
onPressAvatar={() => {
|
|
|
this.props.onPressAvatar && this.props.onPressAvatar();
|
...
|
...
|
@@ -61,26 +63,42 @@ export default class SubjectPost extends Component { |
|
|
{this.renderLikeAvatar(rowData.praiseUsers)}
|
|
|
<Text style={styles.likeText}>{rowData.praise + '人点赞'}</Text>
|
|
|
</View>
|
|
|
<View style={styles.rightContainer}>
|
|
|
<View style={styles.rightLikeContainer}>
|
|
|
<Text style={styles.browseText}>{rowData.browse + '人看过'}</Text>
|
|
|
</View>
|
|
|
</View>
|
|
|
);
|
|
|
break;
|
|
|
case 'comments':
|
|
|
return (
|
|
|
<View style={styles.commentContainer}>
|
|
|
<UserBrief
|
|
|
avatar={rowData.headIcon}
|
|
|
name={rowData.nickName}
|
|
|
timeago={rowData.timeago}
|
|
|
isOwner={rowData.LZ}
|
|
|
onPressAvatar={() => {
|
|
|
this.props.onPressAvatar && this.props.onPressAvatar();
|
|
|
}}
|
|
|
/>
|
|
|
<SubjectContent blocks={rowData.blocks}/>
|
|
|
<View style={styles.commentSeparator}/>
|
|
|
</View>
|
|
|
);
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
renderLikeAvatar(avatars) {
|
|
|
console.log(avatars);
|
|
|
if (avatars.length) {
|
|
|
avatars.reverse();
|
|
|
return (
|
|
|
<View style={styles.avatarPannel}>
|
|
|
{avatars.map((item, i)=> {
|
|
|
return (
|
|
|
<Image style={[styles.likeAvatar,{right:10*i}]} source={{uri:item.headIcon}}/>
|
|
|
<Image key={i} style={[styles.likeAvatar,{right:10*i}]} source={{uri:item.headIcon}}/>
|
|
|
);
|
|
|
})}
|
|
|
</View>
|
...
|
...
|
@@ -94,11 +112,28 @@ export default class SubjectPost extends Component { |
|
|
dataSource={this.dataSource.cloneWithRowsAndSections(this.props.dataBlob)}
|
|
|
renderRow={this.renderRow}
|
|
|
enableEmptySections={true}
|
|
|
onEndReached={() => {
|
|
|
this.props.onEndReached && this.props.onEndReached();
|
|
|
}}
|
|
|
renderFooter={()=>{
|
|
|
if (this.props.endReached) {
|
|
|
return <LoadMoreIndicator
|
|
|
isVisible={true}
|
|
|
text={'没有更多啦'}
|
|
|
/>
|
|
|
} else {
|
|
|
return <LoadMoreIndicator
|
|
|
isVisible={true}
|
|
|
animating={this.props.isFetching}
|
|
|
/>
|
|
|
}
|
|
|
}}
|
|
|
/>
|
|
|
);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
let {width, height} = Dimensions.get('window');
|
|
|
const styles = StyleSheet.create({
|
|
|
container: {
|
|
|
top: 0,
|
...
|
...
|
@@ -134,7 +169,7 @@ const styles = StyleSheet.create({ |
|
|
flex: 1,
|
|
|
flexDirection: 'row',
|
|
|
alignItems: 'center',
|
|
|
justifyContent: 'flex-end'
|
|
|
justifyContent: 'flex-end',
|
|
|
},
|
|
|
likeAvatar: {
|
|
|
width: 30,
|
...
|
...
|
@@ -143,7 +178,7 @@ const styles = StyleSheet.create({ |
|
|
},
|
|
|
likeText: {
|
|
|
fontSize: 14,
|
|
|
left: 10,
|
|
|
left: -10,
|
|
|
},
|
|
|
browseText: {
|
|
|
fontSize: 14,
|
...
|
...
|
@@ -156,6 +191,17 @@ const styles = StyleSheet.create({ |
|
|
backgroundColor: 'white',
|
|
|
paddingLeft: 15,
|
|
|
},
|
|
|
commentContainer: {
|
|
|
paddingTop: 10,
|
|
|
paddingLeft: 15,
|
|
|
paddingRight: 15,
|
|
|
backgroundColor: 'white',
|
|
|
},
|
|
|
commentSeparator: {
|
|
|
backgroundColor: '#a0a0a0',
|
|
|
height: 0.5,
|
|
|
width: width-30,
|
|
|
},
|
|
|
headerRight: {
|
|
|
flex: 1,
|
|
|
flexDirection: 'row',
|
...
|
...
|
|