Commit 14018193 authored by santhosh's avatar santhosh
Browse files

chat last message

parent 1f3cdb63
Showing with 32 additions and 24 deletions
+32 -24
......@@ -54,7 +54,7 @@ export default class AdminChatUser extends Component {
action: this.props.navigation.state.params.action,
empId: this.props.navigation.state.params.empId,
device_id: this.props.navigation.state.params.device_id,
player_id:this.props.navigation.state.params.player_id,
player_id: this.props.navigation.state.params.player_id,
name: this.props.navigation.state.params.name,
sno: this.props.navigation.state.params.sno,
......@@ -118,7 +118,7 @@ export default class AdminChatUser extends Component {
if (responseJson.status === 'True') {
console.warn(responseJson);
this.setState({
dataSource: responseJson.data,
dataSource: responseJson.data.reverse(),
});
} else {
this.setState({
......@@ -180,7 +180,7 @@ export default class AdminChatUser extends Component {
receivedBy: this.props.navigation.state.params.empId,
projectId: projectId,
device_id: device_id,
player_id:player_id,
player_id: player_id,
})
})
......@@ -314,7 +314,7 @@ export default class AdminChatUser extends Component {
messagedBy: userToken,
projectId: projectId,
device_id: this.state.device_id,
player_id:"",
player_id: "",
reply_id: this.state.commentDetails.id ? this.state.commentDetails.id : ""
})
......@@ -478,13 +478,15 @@ export default class AdminChatUser extends Component {
{/* <KeyboardAvoidingView> */}
<View style={styles.container}>
<ScrollView
ref={ref => { this.scrollView = ref }}
onContentSizeChange={() => this.scrollView.scrollToEnd({ y: 0, animated: false })}
horizontal={true}
showsHorizontalScrollIndicator={true}
// ref={ref => { this.scrollView = ref }}
// onContentSizeChange={() => this.scrollView.scrollToEnd({ y: 0, animated: false })}
>
<FlatList style={styles.list}
inverted
data={this.state.dataSource}
keyExtractor={(item) => {
......
......@@ -540,7 +540,7 @@ export default class GroupChat extends Component {
if (responseJson.status === 'True') {
console.warn(responseJson);
this.setState({
dataSource: responseJson.data,
dataSource: responseJson.data.reverse(),
});
} else {
this.setState({
......@@ -808,13 +808,15 @@ export default class GroupChat extends Component {
{/* <KeyboardAvoidingView> */}
<View style={styles.container}>
<ScrollView
ref={ref => { this.scrollView = ref }}
onContentSizeChange={() => this.scrollView.scrollToEnd({ y: 0, animated: false })}
horizontal={true}
showsHorizontalScrollIndicator={false}
// ref={ref => { this.scrollView = ref }}
// onContentSizeChange={() => this.scrollView.scrollToEnd({ y: 0, animated: false })}
>
<FlatList style={styles.list}
inverted
data={this.state.dataSource}
keyExtractor={(item) => {
......@@ -838,7 +840,7 @@ export default class GroupChat extends Component {
<View style={{ padding: 5, }}>
{itemStyle === styles.itemOut ? <View style={{ flexDirection: 'row' }}><Text style={{ fontSize: 12, color: 'orange' }}>{item.reply_username}</Text></View> : <View style={{ flexDirection: 'row' }}><Text style={{ fontSize: 12, color: 'blue' }}>{item.username}</Text></View>}
{item.reply_path !== "" ? <Image source={{ uri: item.reply_path }} style={{ width: 210, height: 50 }} /> : null}
<Text style={{ width: 210 }} selectable={true} key={Math.random()}>{item.reply_message}</Text>
<Text style={{width:210}} selectable={true} key={Math.random()}>{item.reply_message}</Text>
{!inMessage && this.renderDate(moment(item.messagedTime).format('MM.DD.YYYY hh:mm:ss'))}
{inMessage && this.renderDate(moment(item.messagedTime).format('MM.DD.YYYY hh:mm:ss'))}
</View>
......@@ -848,7 +850,7 @@ export default class GroupChat extends Component {
<View style={{ padding: 5, }}>
{itemStyle === styles.itemOut ? <View style={{ flexDirection: 'row' }}><Text style={{ fontSize: 12, color: 'orange' }}>{item.username}</Text><TouchableOpacity onPress={() => this.handlecom(item)} ><Icon color={'#C0C0C0'} size={25} style={{ marginLeft: 10 }} name="reply" /></TouchableOpacity></View> : <View style={{ flexDirection: 'row' }}><Text style={{ fontSize: 12, color: 'blue' }}>{item.username}</Text><TouchableOpacity onPress={() => this.handlecom(item)} ><Icon color={'#C0C0C0'} size={25} style={{ marginLeft: 10 }} name="reply" /></TouchableOpacity></View>}
{item.path !== "" ? <Image source={{ uri: item.path }} style={styles.imageview} /> : null}
<Text style={{ width: 210 }} selectable={true} key={Math.random()}>{item.message}</Text>
<Text style={{width:210}} selectable={true} key={Math.random()}>{item.message}</Text>
{!inMessage && this.renderDate(moment(item.messagedTime).format('MM.DD.YYYY hh:mm:ss'))}
{inMessage && this.renderDate(moment(item.messagedTime).format('MM.DD.YYYY hh:mm:ss'))}
</View>
......@@ -860,7 +862,7 @@ export default class GroupChat extends Component {
<View style={{ padding: 5, }}>
{itemStyle === styles.itemOut ? <View style={{ flexDirection: 'row' }}><Text style={{ fontSize: 12, color: 'orange' }}>{item.username}</Text><TouchableOpacity onPress={() => this.handlecom(item)} ><Icon color={'#C0C0C0'} size={25} style={{ marginLeft: 10 }} name="reply" /></TouchableOpacity></View> : <View style={{ flexDirection: 'row' }}><Text style={{ fontSize: 12, color: 'blue' }}>{item.username}</Text><TouchableOpacity onPress={() => this.handlecom(item)} ><Icon color={'#C0C0C0'} size={25} style={{ marginLeft: 10 }} name="reply" /></TouchableOpacity></View>}
{item.path !== "" ? <Image source={{ uri: item.path }} style={styles.imageview} /> : null}
<Text selectable={true} key={Math.random()}>{item.message}</Text>
<Text style={{width:210}} selectable={true} key={Math.random()}>{item.message}</Text>
{!inMessage && this.renderDate(moment(item.messagedTime).format('MM.DD.YYYY hh:mm:ss'))}
{inMessage && this.renderDate(moment(item.messagedTime).format('MM.DD.YYYY hh:mm:ss'))}
</View>
......
......@@ -534,7 +534,7 @@ export default class TaskChat extends Component {
if (responseJson.status === 'True') {
// alert("messages" + JSON.stringify(responseJson));
this.setState({
dataSource: responseJson.data,
dataSource: responseJson.data.reverse(),
});
} else {
this.setState({
......@@ -803,12 +803,14 @@ export default class TaskChat extends Component {
{/* <KeyboardAvoidingView> */}
<View style={styles.container}>
<ScrollView
ref={ref => { this.scrollView = ref }}
onContentSizeChange={() => this.scrollView.scrollToEnd({ y: 0, animated: false })}
horizontal={true}
showsHorizontalScrollIndicator={false}
// ref={ref => { this.scrollView = ref }}
// onContentSizeChange={() => this.scrollView.scrollToEnd({ y: 0, animated: false })}
>
<FlatList style={styles.list}
inverted
data={this.state.dataSource}
keyExtractor={(item) => {
......@@ -878,7 +880,7 @@ export default class TaskChat extends Component {
<View style={this.state.handleHover === true ? styles.footer1 : styles.footer}>
{this.state.handleHover === true ?
<View>
<View style={styles.itemBottom}>
<View style={styles.itemBottom}>
<View style={{ width: "90%" }}>
<Text style={{ fontSize: 12, color: 'green' }}>{this.state.commentDetails.username}</Text>
<Text style={{ fontSize: 12, color: 'black' }}>{this.state.commentDetails.message}</Text>
......
......@@ -131,7 +131,7 @@ export default class UserChat extends Component {
if (responseJson.status === 'True') {
console.warn(responseJson);
this.setState({
dataSource: responseJson.data,
dataSource: responseJson.data.reverse(),
});
} else {
this.setState({
......@@ -397,13 +397,15 @@ export default class UserChat extends Component {
{/* <KeyboardAvoidingView> */}
<View style={styles.container}>
<ScrollView
ref={ref => { this.scrollView = ref }}
onContentSizeChange={() => this.scrollView.scrollToEnd({ y: 0, animated: false })}
horizontal={true}
showsHorizontalScrollIndicator={false}
// ref={ref => { this.scrollView = ref }}
// onContentSizeChange={() => this.scrollView.scrollToEnd({ y: 0, animated: false })}
>
<FlatList style={styles.list}
inverted
data={this.state.dataSource}
keyExtractor={(item) => {
return item.id;
......
......@@ -16,7 +16,7 @@
/*****Postgress********/
// //pre production environment (development)
//pre production environment (development)
export const API = "https://api-single.agile24x7.com/pg_migration/";
export const CHATAPI = "https://api-single.agile24x7.com/pg_migration";
export const ReportsAPI = "https://pgtestreporting.agile24x7.com/";
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment