-
Notifications
You must be signed in to change notification settings - Fork 427
/
Copy pathReleaseItem.js
98 lines (89 loc) · 2.98 KB
/
ReleaseItem.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/**
* Created by guoshuyu on 2017/11/11.
*/
import React, {
Component,
} from 'react'
import {
View, Text, Image, TouchableOpacity
} from 'react-native';
import PropTypes from 'prop-types';
import styles from '../../style'
import * as Constant from '../../style/constant'
import TimeText from './TimeText'
import HTMLView from '../common/CommonHtmlView';
/**
* 发布列表Item
*/
class ReleaseItem extends Component {
constructor(props) {
super(props)
}
componentDidMount() {
}
componentWillUnmount() {
}
render() {
let {actionTime, actionTitle, actionUserPic, actionTargetHtml, actionTarget} = this.props;
let body = (actionTargetHtml) ? <HTMLView
style={[{
marginTop: Constant.normalMarginEdge / 2,
backgroundColor: Constant.transparentColor
}]}
selectable={true}
numberOfLines={100}
value={actionTarget}
textComponentProps={{
style: styles.subSmallText,
numberOfLines: 100,
}}
stylesheet={{pre: styles.inCode, code: styles.pCode}}
textComponent={() => {
return (
<Text/>
)
}}
/> : <Text style={[styles.subSmallText,]}>{actionTargetHtml}</Text>;
return (
<TouchableOpacity
style={[{
marginVertical: Constant.normalMarginEdge / 2,
marginLeft: Constant.normalMarginEdge,
marginRight: Constant.normalMarginEdge,
padding: Constant.normalMarginEdge,
borderRadius: 4,
}, styles.shadowCard]}
onLongPress={()=>{
this.props.onLongPressItem && this.props.onLongPressItem();
}}
onPress={() => {
this.props.onPressItem && this.props.onPressItem();
}}>
<View style={[styles.flexDirectionRowNotFlex,]}>
<View style={[styles.flex, styles.centerH, styles.flexDirectionRowNotFlex]}>
<Text style={[styles.flex, styles.smallText, {
fontWeight: "bold",
marginLeft: Constant.normalMarginEdge / 2
}]}>
{actionTitle}
</Text>
<TimeText style={[styles.subSmallText,
{marginTop: -20}]}
time={actionTime}/>
</View>
</View>
{body}
</TouchableOpacity>
)
}
}
const propTypes = {
actionTime: PropTypes.string,
actionTitle: PropTypes.string,
actionMode: PropTypes.string,
actionTarget: PropTypes.string,
onPressItem: PropTypes.func,
onLongPressItem: PropTypes.func,
};
ReleaseItem.propTypes = propTypes;
export default ReleaseItem