-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
86 lines (82 loc) · 2.76 KB
/
index.js
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
79
80
81
82
83
84
85
86
import React, { useState } from 'react';
import { FlatList, RefreshControl, SafeAreaView } from 'react-native';
import { BaseStyle, useTheme } from './config';
import {
Header,
Icon,
Text,
RateDetail,
CommentItem,
} from './components';
import { ReviewData } from './data';
import { useTranslation } from 'react-i18next';
export default Review = () => {
const { colors } = useTheme();
const { t } = useTranslation();
const [refreshing] = useState(false);
const [rateDetail] = useState({
point: 4.7,
maxPoint: 5,
totalRating: 5,
data: ['5%', '5%', '35%', '40%', '10%'],
});
const [reviewList] = useState(ReviewData);
return (
<SafeAreaView style={BaseStyle.safeAreaView} forceInset={{ top: 'always' }}>
<Header
title={t('Reviews')}
renderLeft={() => {
return (
<Icon
name="arrow-left"
size={20}
color={colors.primary}
enableRTL={true}
/>
);
}}
renderRight={() => {
return (
<Text headline primaryColor numberOfLines={1}>
{t('Replay')}
</Text>
);
}}
onPressLeft={() => { }}
onPressRight={() => { }}
/>
<FlatList
contentContainerStyle={{ padding: 20 }}
refreshControl={
<RefreshControl
colors={[colors.primary]}
tintColor={colors.primary}
refreshing={refreshing}
onRefresh={() => { }}
/>
}
data={reviewList}
keyExtractor={(item, index) => item.id}
ListHeaderComponent={() => (
<RateDetail
point={rateDetail.point}
maxPoint={rateDetail.maxPoint}
totalRating={rateDetail.totalRating}
data={rateDetail.data}
/>
)}
renderItem={({ item }) => (
<CommentItem
style={{ marginTop: 10 }}
image={item.source}
name={item.name}
rate={item.rate}
date={item.date}
title={item.title}
comment={item.comment}
/>
)}
/>
</SafeAreaView>
);
};