-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathApp.js
257 lines (244 loc) · 6.21 KB
/
App.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
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
import React from 'react';
import {
StyleSheet,
Button,
View,
SafeAreaView,
Text,
Alert,
Image,
TextInput,
Linking,
} from 'react-native';
import ButtonSpinner from 'react-native-button-spinner';
import Icons from 'react-native-vector-icons/MaterialCommunityIcons';
import Apple from 'react-native-vector-icons/FontAwesome5';
import Buttons from './components/view/Buttons';
import { LinearGradient } from 'expo-linear-gradient';
import image from './components/view/good1.png';
import image2 from './components/view/hi.png';
// axios 인스턴스 생성
const Separator = () => <View style={styles.separator} />;
export default function App() {
const [id, onChangeText] = React.useState('');
const [pw, onChangePw] = React.useState('');
const [backGradient, onChangeGradient] = React.useState([
{
color: ['#00008C', '#3b5998', '#4c669f'],
},
{
color: ['#1b2735', '0%', '#090a0f'],
},
{
color: ['#000C40', '#F0F2F0'],
},
{
color: ['#F0F2F0', '#000C40'],
},
{
color: ['#000046', '#1CB5E0'],
},
{
color: ['#16222A', '#3A6073'],
},
{
color: ['#191654', '#43C6AC'],
},
{
color: ['#43C6AC', '#191654'],
},
{
color: ['#2ebf91', '#8360c3'],
},
]);
const [users, setUsers] = React.useState([
{
mode: 1,
duration: '1일 외박 신청',
icon: 'cannabis',
color: '#FF4646',
},
{
mode: 2,
duration: '1주 외박 신청',
icon: 'carrot',
color: '#E56D29',
},
{
mode: 3,
duration: '2주 외박 신청',
icon: 'seedling',
color: 'green',
},
{
mode: 4,
duration: '한달 외박 신청',
icon: 'tint',
color: '#00E1FF',
},
]);
const [mode, onChangeMode] = React.useState('1');
React.useEffect(() => {
Alert.alert(
'-Notice-',
'1. 한 달 외박 신청시 시간제한으로 인해 완료 메시지가 안뜨는 경우가 있습니다.(오류로 표현)\n 2. 24 : 00 ~ 01 : 00 까지 통정시가 열리지 않으므로 이 시간대를 피해서 신청해주세요! ',
[{ text: '확인' }],
{ cancelable: false }
);
}, []);
// const awaitSendRequest = () => {
// return new Promise((resolve, reject) => {
// // oneDay({ id, pw, mode }).then(function (response) {
// // const { message } = JSON.parse(response.data.body);
// // onChangeResult(message);
// // resolve(message);
// // });
// onChangeResult('외박신청 완료');
// resolve('hi');
// });
// };
const onClickMessageToMe = () => {
Linking.openURL('https://open.kakao.com/o/sA4uughd');
};
const onClickToSurvey = () => {
Linking.openURL('http://naver.me/GKoSugrJ');
};
return (
<LinearGradient colors={backGradient[2].color} style={styles.container}>
<SafeAreaView style={styles.items}>
<View style={styles.blankView}></View>
<Icons name="power-sleep" size={80} style={styles.title} />
<View style={{ flex: 2 }}></View>
<View style={styles.inputWithString}>
<Text style={[styles.inputString, { marginTop: 13 }]}>I D :</Text>
<TextInput
style={styles.inputIdPw}
autoCompleteType="username"
editable={true}
value={id}
autoCapitalize="none"
onChangeText={(id) => onChangeText(id)}
/>
</View>
<View style={styles.inputWithString}>
<Text style={[styles.inputString, { marginTop: 13 }]}>PW :</Text>
<TextInput
style={styles.inputIdPw}
autoCompleteType="password"
secureTextEntry={true}
onChangeText={(pw) => onChangePw(pw)}
value={pw}
/>
</View>
<View style={styles.blankView}></View>
{users.map((user) => (
<Buttons user={user} key={user.mode} id={id} pw={pw}></Buttons>
))}
<ButtonSpinner
style={styles.buttonBorder}
textButton={'Text Button'}
onPress={onClickMessageToMe}
>
<Apple
name="comment-alt"
size={17}
color="black"
style={{ alignContent: 'center' }}
/>
<Text>{' '}</Text>
<Text style={{ color: 'white' }}>개발자 건의사항</Text>
</ButtonSpinner>
<ButtonSpinner
style={styles.buttonBorder}
textButton={'Text Button'}
onPress={onClickToSurvey}
>
<Apple
name="check"
size={17}
color="black"
style={{ alignContent: 'center' }}
/>
<Text>{' '}</Text>
<Text style={{ color: 'white' }}>설문 조사</Text>
</ButtonSpinner>
<Image
onClick={onClickToSurvey}
style={styles.stretch}
source={image}
/>
<Image style={styles.stretch2} source={image2} />
</SafeAreaView>
</LinearGradient>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
},
items: {
flex: 1,
marginHorizontal: 12,
},
title: {
textAlign: 'center',
marginVertical: 8,
color: '#FFD228',
},
fixToText: {
flexDirection: 'row',
justifyContent: 'space-between',
},
separator: {
marginVertical: 8,
borderBottomColor: '#737373',
borderBottomWidth: StyleSheet.hairlineWidth,
},
inputIdPw: {
height: 40,
color: 'white',
borderColor: 'white',
borderRadius: 10,
borderWidth: 0.5,
marginRight: 15,
paddingLeft: 10,
flex: 8,
marginBottom: 10,
},
stretch: {
alignSelf: 'flex-end',
marginLeft: 10,
flexDirection: 'row',
flex: 3,
width: 50,
height: 60,
resizeMode: 'stretch',
},
stretch2: {
alignSelf: 'center',
resizeMode: 'stretch',
marginTop: -3,
flex: 4,
width: '120%',
marginBottom: -40,
},
inputString: {
flex: 1,
paddingLeft: 13,
color: 'white',
},
blankView: {
flex: 3,
justifyContent: 'flex-end',
alignItems: 'flex-end',
},
inputWithString: {
flexDirection: 'row',
},
buttonBorder: {
color: 'white',
borderColor: 'white',
borderRadius: 10,
borderWidth: 0.7,
},
});