ReviewItem.js
3.12 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
72
73
74
75
76
77
78
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 Star from './Star'
import moment from 'moment'
import {get} from 'axios'
import { SERVER } from '../common/servername';
import Camera from '../assets/Camera_big.svg'
import AsyncStorage from '@react-native-community/async-storage';
export default ({ item,navigation,user,store}) => {
const [User,setUser] = React.useState({})
React.useEffect(() => {
AsyncStorage.getItem('user',(err,res) => {
if(res ) {
setUser(JSON.parse(res))
}
})
},[])
return (
<View style={{backgroundColor:"white",marginBottom:16}}>
<View style={{flexDirection:"row"}}>
<Image style={{width:30,height:30,borderRadius:100}} source={item.name?{uri:item.image}:{uri:item.profile}}/>
<View style={{justifyContent:"center",marginLeft:8}}>
<Text style={{fontSize:12,color:"#615F5F"}}> {item.name?item.name:item.reviewWriter}</Text>
</View>
{item.UserId === User.id?
<TouchableOpacity style={{marginLeft:"auto"}}>
<Text style={{color:"#615F5F",fontSize:12,fontWeight:"bold",borderBottomColor:"#615F5F",borderBottomWidth:1}}>
삭제
</Text>
</TouchableOpacity>:undefined}
</View>
<View style={{flexDirection:"row",marginTop:8,marginBottom:4.3}}>
<Star item={item.reviewGrade} style={{flexDirection:"row"}}/>
<View>
<Text style={{fontSize:9,color:"#979292"}}>
{moment(item.updatedAt).format("MM월 DD일")}
</Text>
</View>
</View>
<View style={{marginTop:7.9}}>
<Text>
{item.reviewContent}
</Text>
</View>
{store && item.comment?
<View>
<View style={{marginTop:7.9,backgroundColor:"#F1F1F1",paddingTop:16,paddingBottom:16,paddingLeft:16,paddingRight:16,flexDirection:"row"}}>
{store&& store.profile===null?
<View style={{padding:3,borderColor:"#615F5F",borderWidth:1,backgroundColor:"white",marginRight:10}}>
<Camera width={30} height={25} style={{}}/>
</View>:<Image style={{width:70,height:60,marginRight:10}} source={{uri:item.profile}}/>}
<Text style={{fontSize:12,color:"#615F5F",alignSelf:"center"}}>
{store.name}
</Text>
</View>
<View style={{backgroundColor:"#F1F1F1",paddingBottom:16,paddingLeft:16,paddingRight:16,}}>
<Text>
{item.comment}
</Text>
</View>
</View>:undefined}
</View>
)
}
const style = StyleSheet.create({
text:{
color:"#707070",
fontSize:11,
fontWeight:"900"
}
})