...
|
...
|
@@ -7,6 +7,7 @@ import UserBrief from './UserBrief'; |
|
|
import Thumbs from './Thumbs';
|
|
|
import SectionItem from './SectionItem';
|
|
|
import NumberButton from './NumberButton';
|
|
|
import emojiDecter from '../../utils/emojiDecter';
|
|
|
|
|
|
const {
|
|
|
View,
|
...
|
...
|
@@ -62,8 +63,25 @@ export default class ListCell extends React.Component { |
|
|
let data = this.props.data.toJS();
|
|
|
let {author, timeago, isOwner, isTop, isLike, id, title, desc, thumbs, section, commentCount, likeCount} = data;
|
|
|
let likeImage = isLike ? require('../../images/home/like.png') : require('../../images/home/unlike.png');
|
|
|
let titleStyle = emojiDecter(title) ? null : {paddingTop: -(28 - 18) / 2};
|
|
|
let descStyle = emojiDecter(desc) ? null : {paddingTop: -(23 - 14) / 2};
|
|
|
let hideSection = this.props.hideSection;
|
|
|
let bottomStyle = hideSection ? {alignSelf: 'flex-end'} : null;
|
|
|
let thumbMarginTop = 10;
|
|
|
let bottomMarginTop = 15;
|
|
|
if (title && !desc && thumbs.length == 0) {
|
|
|
bottomMarginTop = 8;
|
|
|
}
|
|
|
if (title && desc && thumbs.length == 0) {
|
|
|
bottomMarginTop = 10;
|
|
|
}
|
|
|
if (title && desc && thumbs.length > 0) {
|
|
|
thumbMarginTop = 14;
|
|
|
bottomMarginTop = 15;
|
|
|
}
|
|
|
if (title && !desc && thumbs.length > 0) {
|
|
|
thumbMarginTop = 9;
|
|
|
}
|
|
|
return (
|
|
|
<TouchableOpacity
|
|
|
style={styles.row}
|
...
|
...
|
@@ -84,10 +102,10 @@ export default class ListCell extends React.Component { |
|
|
/>
|
|
|
{isTop ? <Text style={styles.topTag}>置顶</Text> : null}
|
|
|
</View>
|
|
|
{title ? <Text style={styles.title} numberOfLines={2}>{title}</Text> : null}
|
|
|
{desc ? <Text style={styles.desc} numberOfLines={2}>{desc}</Text> : null}
|
|
|
{thumbs.length > 0 ? <Thumbs style={styles.thumbs} data={thumbs}/> : null}
|
|
|
<View style={[styles.bottom, bottomStyle]}>
|
|
|
{title ? <Text style={[styles.title, titleStyle]} numberOfLines={2}>{title}</Text> : null}
|
|
|
{desc ? <Text style={[styles.desc, descStyle]} numberOfLines={2}>{desc}</Text> : null}
|
|
|
{thumbs.length > 0 ? <Thumbs style={[styles.thumbs, {marginTop: thumbMarginTop}]} data={thumbs}/> : null}
|
|
|
<View style={[styles.bottom, bottomStyle, {marginTop: bottomMarginTop}]}>
|
|
|
{hideSection ? null : <SectionItem
|
|
|
name={section.name}
|
|
|
onPressSection={() => {
|
...
|
...
|
@@ -141,23 +159,23 @@ let styles = StyleSheet.create({ |
|
|
paddingTop: 4.5,
|
|
|
},
|
|
|
title: {
|
|
|
marginTop: -6,
|
|
|
fontSize: 18,
|
|
|
lineHeight: 28,
|
|
|
paddingTop: -(28 - 18) / 2 - 2,
|
|
|
},
|
|
|
desc: {
|
|
|
marginTop: 3,
|
|
|
fontSize: 14,
|
|
|
lineHeight: 23,
|
|
|
color: '#888888',
|
|
|
paddingTop: -(23 - 14) / 2,
|
|
|
},
|
|
|
thumbs: {
|
|
|
marginTop: 15,
|
|
|
marginTop: 10,
|
|
|
},
|
|
|
bottom: {
|
|
|
flexDirection: 'row',
|
|
|
justifyContent: 'space-between',
|
|
|
marginTop: 15,
|
|
|
marginTop: 12,
|
|
|
marginBottom: 15,
|
|
|
},
|
|
|
buttonContainer: {
|
...
|
...
|
|