Authored by shangjf

新增站内信样式 review by 张同海

... ... @@ -24,6 +24,7 @@ import MessageListTextCell from './MessageListTextCell';
import MessageListOrderCell from './MessageListOrderCell';
import YH_ToolTips from '../../../common/components/YH_ToolTips'
import MessageListEditBottomView from './MessageListEditBottomView'
import MessageListActivityCell from './MessageListActivityCell'
export default class MessageList extends Component {
constructor(props) {
... ... @@ -64,7 +65,6 @@ export default class MessageList extends Component {
case 207:
case 208:
case 209:
case 500:
{
return(
<MessageListSmallIconCell
... ... @@ -85,6 +85,27 @@ export default class MessageList extends Component {
);
}
break;
case 500:
{
return(
<MessageListActivityCell
itemData={rowData}
onPressListItem={(itemData) =>{
this.setState({showToolTips: false});
this.props.onPressListItem && this.props.onPressListItem(itemData, rowID)
}
}
onLongPressListItem={(itemData) =>{
this.onLongPressListItem(itemData,rowID);
}}
selectListItem={(itemData) =>{
this.props.selectListItem&&this.props.selectListItem(rowID);
}}
isEditing={isEditing}
/>
);
}
break;
case 200:
case 201:
case 403:
... ...
'use strict';
import React, {Component} from 'react';
import ReactNative, {
View,
Text,
Image,
StyleSheet,
Dimensions,
Platform,
TouchableOpacity,
} from 'react-native';
import MessageListCellFooter from './MessageListCellFooter'
import YH_ToolTips from '../../../common/components/YH_ToolTips'
import SlicedImage from '../../../common/components/SlicedImage'
import EditIconView from './EditIconView'
export default class MessageListActivityCell extends Component {
constructor(props) {
super(props);
}
render() {
let {itemData, isEditing} = this.props;
let body = itemData.get('body');
let imageUri = body ? body.get('img_url','www.yohobuy.com') : 'www.yohobuy.com';
let content = body ? body.get('content','') : '';
let isSelected = itemData.get('isSelected');
imageUri = SlicedImage.getSlicedUrl(imageUri, 50, 50, 2);
let borderLeftWidth = isEditing ? 1 : 0;
let borderLeftColor = isEditing ? '#e0e0e0' : 'transparent';
let editStyle = {borderLeftWidth, borderLeftColor};
return(
<View style={styles.editContainer}>
{
isEditing
?
<EditIconView isSelected={isSelected} onSelectPress={() =>{
this.props.selectListItem&&this.props.selectListItem(itemData);
}}/>
:
null
}
<View style={[styles.container, editStyle]}>
<TouchableOpacity
activeOpacity={1}
disabled={isEditing}
onLongPress={() =>{
this.props.onLongPressListItem && this.props.onLongPressListItem(itemData);
}}
onPress={() =>{
this.props.onPressListItem && this.props.onPressListItem(itemData);
}}
>
<View style={styles.contentContainer}>
<View style={styles.descStyle}>
<Image
style={styles.iconStyle}
source={{uri: imageUri}}
resizeMode="contain"
/>
<View style={styles.textContainer}>
<Text
numberOfLines={2}
style={styles.titleStyle}
>
{itemData.get('title')}
</Text>
<Text
style={styles.detail}
numberOfLines={2}
>
{content}
</Text>
</View>
</View>
</View>
</TouchableOpacity>
<MessageListCellFooter
onPressListItem={this.props.onPressListItem}
itemData={itemData}
/>
</View>
</View>
)
};
}
let {width, height} = Dimensions.get('window');
const DEVICE_WIDTH_RATIO = width / 375;
let styles = StyleSheet.create({
editContainer: {
flexDirection: 'row'
},
container: {
backgroundColor: 'white',
width
},
contentContainer: {
flex: 1,
minHeight: 71,
flexDirection: 'column',
backgroundColor: 'white',
justifyContent: 'center'
},
textContainer: {
flex: 1,
flexDirection: 'column',
},
titleStyle: {
marginLeft: 10,
fontSize: 13,
fontWeight: 'bold',
color: '#444444',
marginRight: 15,
backgroundColor: 'white'
},
descStyle:{
flexDirection: 'row',
backgroundColor: 'white'
},
iconStyle: {
marginLeft: 15,
backgroundColor: 'white',
width: 50,
height: 50
},
detail:{
marginLeft: 10,
fontSize: 13,
fontWeight: 'bold',
color: '#444444',
maxWidth: width-15-50-10-22,
lineHeight: 18,
backgroundColor: 'white'
}
})
... ...