-
Notifications
You must be signed in to change notification settings - Fork 0
/
Result.js
223 lines (213 loc) · 8.05 KB
/
Result.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
import React, {useState} from 'react';
import { StyleSheet, Text, View, StatusBar, ImageBackground, Image, TouchableOpacity } from 'react-native';
import ResultLoading from './ResultLoading'
export default function Result({ route, navigation }) {
const [isLoading, setIsLoading] = useState(true)
const {insta_id} = route.params
const {age} = route.params
const {gender} = route.params
const {region} = route.params
const {interest} = route.params
var manImages = [
require('./assets/resultImage/남자_10대_1.png'),
require('./assets/resultImage/남자_10대_2.png'),
require('./assets/resultImage/남자_10대_3.png'),
require('./assets/resultImage/남자_10대_4.png'),
require('./assets/resultImage/남자_10대_5.png'),
require('./assets/resultImage/남자_20대_1.png'),
require('./assets/resultImage/남자_20대_2.png'),
require('./assets/resultImage/남자_20대_3.png'),
require('./assets/resultImage/남자_20대_4.png'),
require('./assets/resultImage/남자_20대_5.png'),
require('./assets/resultImage/남자_30대_1.png'),
require('./assets/resultImage/남자_30대_2.png'),
require('./assets/resultImage/남자_30대_3.png'),
require('./assets/resultImage/남자_30대_4.png'),
require('./assets/resultImage/남자_30대_5.png'),
require('./assets/resultImage/남자_40대_1.png'),
require('./assets/resultImage/남자_40대_2.png'),
require('./assets/resultImage/남자_40대_3.png'),
require('./assets/resultImage/남자_40대_4.png'),
require('./assets/resultImage/남자_40대_5.png'),
]
var womanImages = [
require('./assets/resultImage/여자_10대_1.png'),
require('./assets/resultImage/여자_10대_2.png'),
require('./assets/resultImage/여자_10대_3.png'),
require('./assets/resultImage/여자_10대_4.png'),
require('./assets/resultImage/여자_10대_5.png'),
require('./assets/resultImage/여자_20대_1.png'),
require('./assets/resultImage/여자_20대_2.png'),
require('./assets/resultImage/여자_20대_3.png'),
require('./assets/resultImage/여자_20대_4.png'),
require('./assets/resultImage/여자_20대_5.png'),
require('./assets/resultImage/여자_30대_1.png'),
require('./assets/resultImage/여자_30대_2.png'),
require('./assets/resultImage/여자_30대_3.png'),
require('./assets/resultImage/여자_30대_4.png'),
require('./assets/resultImage/여자_30대_5.png'),
require('./assets/resultImage/여자_40대_1.png'),
require('./assets/resultImage/여자_40대_2.png'),
require('./assets/resultImage/여자_40대_3.png'),
require('./assets/resultImage/여자_40대_4.png'),
require('./assets/resultImage/여자_40대_5.png'),
]
setTimeout(() => { setIsLoading(false) }, 10000);
if(isLoading) {
return <ResultLoading/>
}
return(
<ImageBackground source={require('./assets/result/결과화면-배경.jpg')} style={styles.container}>
<StatusBar barStyle='light-content'></StatusBar>
<View style={styles.idView}>
<Image style={styles.fishLeft} source={require('./assets/result/보라물고기-왼쪽.png')}/>
<Text style={styles.idText}>{insta_id}</Text>
<Image style={styles.idIs} source={require('./assets/result/님은.png')}/>
<Image style={styles.fishRight} source={require('./assets/result/보라물고기-오른쪽.png')}/>
</View>
<View style={styles.resultView}>
{gender == '남자' && age == '10대' && <Image style={styles.image} source={manImages[Math.floor(Math.random() * 5)]}/>}
{gender == '남자' && age == '20대' && <Image style={styles.image} source={manImages[5 + Math.floor(Math.random() * 5)]}/>}
{gender == '남자' && age == '30대' && <Image style={styles.image} source={manImages[10 + Math.floor(Math.random() * 5)]}/>}
{gender == '남자' && age == '40대 이상' && <Image style={styles.image} source={manImages[15 + Math.floor(Math.random() * 5)]}/>}
{gender == '여자' && age == '10대' && <Image style={styles.image} source={womanImages[Math.floor(Math.random() * 5)]}/>}
{gender == '여자' && age == '20대' && <Image style={styles.image} source={womanImages[5 + Math.floor(Math.random() * 5)]}/>}
{gender == '여자' && age == '30대' && <Image style={styles.image} source={womanImages[10 + Math.floor(Math.random() * 5)]}/>}
{gender == '여자' && age == '40대 이상' && <Image style={styles.image} source={womanImages[15 + Math.floor(Math.random() * 5)]}/>}
<Image style={styles.ageBubble} source={require('./assets/result/수정-물방울(나이).png')}/>
<Text style={styles.ageText}>{age}</Text>
<Image style={styles.regionBubble} source={require('./assets/result/수정물방울(지역).png')}/>
<Text style={styles.regionText}>{region}</Text>
<Image style={styles.genderBubble} source={require('./assets/result/수정물방울(성별).png')}/>
<Text style={styles.genderText}>{gender}</Text>
<Image style={styles.hobbyBubble} source={require('./assets/result/수정물방울(관심사).png')}/>
<Text style={styles.hobbyText}>{interest}</Text>
</View>
<View style={styles.buttonView}>
<TouchableOpacity onPress={() => navigation.goBack()}>
<Image style={styles.completeButton} source={require('./assets/result/분석완료버튼.png')}/>
</TouchableOpacity>
<TouchableOpacity>
<Image style={styles.shareButton} source={require('./assets/result/공유버튼.png')}/>
</TouchableOpacity>
</View>
</ImageBackground>
)
}
const styles = StyleSheet.create({
container: {
flex: 1
},
idView: {
height: '15%',
flexDirection: 'row',
alignItems: 'flex-end',
justifyContent: 'center'
},
idText: {
fontSize: 25,
color: '#747474',
marginHorizontal: 10,
color: '#D04C5B'
},
idIs: {
width: 40,
height: 25,
marginRight: 10
},
fishLeft: {
width: 40,
height: 25
},
fishRight: {
width: 37,
height: 20,
marginBottom: 1
},
resultView: {
height: '69%',
alignItems: 'center',
justifyContent: 'center'
},
image: {
height: 370,
resizeMode: 'contain',
marginTop: '15%'
},
ageBubble: {
width: 120,
height: 120,
position: 'absolute',
right: '7%',
top: '13%'
},
ageText: {
fontSize: 45,
color: '#767677',
position: 'absolute',
right: '11%',
top: '18%',
transform: [{rotate:'10deg'}]
},
regionBubble: {
width: 100,
height: 105,
position: 'absolute',
left: '5%',
bottom: '15%'
},
regionText: {
fontSize: 25,
color: '#767677',
position: 'absolute',
left: '8%',
bottom: '22%',
transform: [{rotate:'30deg'}]
},
genderBubble: {
width: 91,
height: 88,
position: 'absolute',
left: '10%',
top: '10%'
},
genderText: {
fontSize: 30,
color: '#767677',
position: 'absolute',
left: '14%',
top: '14%',
transform: [{rotate:'-10deg'}]
},
hobbyBubble: {
width: 87,
height: 87,
position: 'absolute',
right: '7%',
bottom: '5%'
},
hobbyText: {
fontSize: 25,
color: '#767677',
position: 'absolute',
right: '12%',
bottom: '10%',
transform: [{rotate:'-20deg'}]
},
buttonView: {
height: '16%',
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'flex-start'
},
completeButton: {
width: 147,
height: 52
},
shareButton: {
width: 32,
height: 32,
marginTop: 10,
marginLeft: 10
}
});