ChatItem.js
2.66 KB
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
import { useState } from 'react';
import {post} from 'axios'
import {Dimensions, View,Text,Image,StyleSheet,TouchableOpacity,Modal,TouchableHighlight,Alert} from 'react-native'
import * as React from 'react'
import moment from 'moment'
import Star from '../assets/star.svg'
import Options from '../assets/Options.svg'
export default ({ item,navigation,keyword}) => {
const [visible,setVisible] = React.useState(true)
React.useEffect(() => {
if(keyword) {
if(item.title.indexOf(keyword)>=0 || item.Message.filter((e,i) => {return e.indexOf(keyword) >= 0}).length > 0) {
setVisible(true)
}
else {
setVisible(false)
}
}
if(!keyword) {
setVisible(true)
}
},[keyword])
return (
<View>
{visible?
<TouchableOpacity onPress={() => navigation.navigate("ChatRoom")} style={{backgroundColor:"white"}}>
<View style={{width:"100%",paddingTop:16,paddingBottom:15.3,borderBottomColor:"#BCBCBD",borderBottomWidth:1}}>
<View style={{flexDirection:"row"}}>
<View style={{justifyContent:"center"}}>
<Image style={{width:45,height:45,marginRight:31,marginLeft:32}} source={require('../assets/img.png')}/>
</View>
<View style={{marginTop:7}}>
<Text style={{fontSize:12,color:"black",marginBottom:9}}>
{item.title}
</Text>
<Text style={{fontSize:12,color:"#615F5F"}}>
{item.Message[item.Message.length-1]}
</Text>
</View>
<View style={{marginLeft:"auto"}}>
<Text style={{fontSize:9,color:"#979292"}}>
12월 21일
</Text>
</View>
</View>
<View style={{flexDirection:"row",marginLeft:"auto"}}>
<Star style={{alignSelf:"center"}}/>
<Star style={{alignSelf:"center"}}/>
<Star style={{alignSelf:"center"}}/>
<Star style={{alignSelf:"center"}}/>
<Star style={{alignSelf:"center"}}/>
<Text style={{marginLeft:8,color:"#615F5F",fontSize:11}}>
4.5
</Text>
</View>
</View>
</TouchableOpacity>:undefined}
</View>
)
}
const style = StyleSheet.create({
text:{
color:"#707070",
fontSize:11,
fontWeight:"900"
}
})