import React, {Component} from 'react';
import CommonTitleBar from '../views/CommonTitleBar';
import CommonLoadingView from '../views/CommonLoadingView';
import ListItemDivider from '../views/ListItemDivider';
import Global from '../utils/Global';
import StorageUtil from '../utils/StorageUtil';
import {Dimensions, Image, ScrollView, StyleSheet, Text, TouchableOpacity, View} from 'react-native';
const {width} = Dimensions.get('window');
export default class ContactDetailScreen extends Component {
constructor(props) {
super(props);
this.state = {
loadingState: Global.loading,
};
// 聊天人的信息
this.userInfo = this.props.navigation.state.params.data;
StorageUtil.get('username', (error, object) => {
if (!error && object != null) {
this.setState({loginUsername: object.username, loadingState: Global.loadSuccess});
}
})
}
render() {
switch (this.state.loadingState) {
case Global.loading:
return this.renderLoadingView();
case Global.loadSuccess:
return this.renderDetailView();
case Global.loadError:
return this.renderErrorView();
}
}
renderLoadingView() {
return (
);
}
renderErrorView() {
return (
this.getUserInfo()}>
加载用户数据失败
点击屏幕重试
);
}
renderDetailView() {
return (
{this.userInfo.title}
{"昵称:" + this.userInfo.nick}
设置备注和标签
地区
湖北 武汉
个人相册
更多
{
this.state.loginUsername == this.userInfo.title ? (null) : (
{
this.startChat()
}}>
发消息
视频聊天
)
}
);
}
startChat() {
this.props.navigation.navigate('Chatting', {'contactId': this.userInfo.title, 'name': this.userInfo.nick});
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
flexDirection: 'column',
backgroundColor: Global.pageBackgroundColor,
},
content: {
flex: 1,
flexDirection: 'column',
},
contactInfoContainer: {
backgroundColor: '#FFFFFF',
flexDirection: 'row',
paddingLeft: 15,
paddingRight: 15,
paddingTop: 10,
paddingBottom: 10,
marginTop: 20,
},
avatar: {
width: 65,
height: 65,
},
contactInfoTextContainer: {
flexDirection: 'column',
paddingLeft: 15,
paddingRight: 15,
},
contactNameText: {
color: '#000000',
fontSize: 16,
},
conatactNickNameText: {
color: '#999999',
marginTop: 5,
fontSize: 14,
},
markContainer: {
backgroundColor: '#FFFFFF',
padding: 15,
marginTop: 20,
},
regionContainer: {
padding: 15,
flexDirection: 'row',
alignItems: 'center',
},
galleryContainer: {
padding: 15,
flexDirection: 'row',
alignItems: 'center',
},
moreContainer: {
padding: 15,
flexDirection: 'row',
alignItems: 'center',
},
markText: {
color: '#000000',
fontSize: 16,
},
regionText: {
fontSize: 14,
color: '#999999'
},
bottomContainer: {
backgroundColor: '#FFFFFF',
marginTop: 20,
},
commonFontStyle: {
color: '#000000',
fontSize: 16,
width: width / 4,
},
galleryImg: {
width: 60,
height: 60,
marginLeft: 5,
marginRight: 5,
},
positiveBtn: {
backgroundColor: '#19AD17',
justifyContent: 'center',
alignItems: 'center',
borderRadius: 5,
marginLeft: 15,
marginRight: 15,
marginTop: 15,
height: 50,
},
positiveBtnText: {
fontSize: 16,
color: '#FFFFFF'
},
normalBtn: {
backgroundColor: '#F8F8F8',
justifyContent: 'center',
alignItems: 'center',
borderRadius: 5,
marginLeft: 15,
marginRight: 15,
marginTop: 15,
height: 50,
},
normalBtnText: {
fontSize: 16,
color: '#000000'
}
});