-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.js
More file actions
132 lines (122 loc) · 3.16 KB
/
Copy pathApp.js
File metadata and controls
132 lines (122 loc) · 3.16 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
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
import React, { useState, useEffect } from 'react';
import { View, Text, StyleSheet, Image, TouchableOpacity } from 'react-native';
const App = () => {
const [data, setData] = useState(null);
useEffect(() => {
fetch('http://192.168.123.107:3000/api/data')
.then(response => response.json())
.then(json => setData(json.message))
.catch(error => console.error('Error fetching data:', error));
}, []);
return (
<View style={styles.body}>
<View style={styles.container}>
<Image source={require('/Users/heodongun/Desktop/myApp/assets/action.png')} style={{ marginTop: 120 }} />
<TouchableOpacity style={styles.loginButton} onPress={login}>
<Text style={styles.loginButtonText}>로그인</Text>
</TouchableOpacity>
<TouchableOpacity style={styles.signupButton} onPress={() => console.log('회원가입 클릭')}>
<Text style={styles.signupButtonText}>회원가입</Text>
</TouchableOpacity>
<Text style={styles.alreadyMember}>이미 회원이신가요?</Text>
<View style={[styles.divider, styles.dividerLeft]}></View>
<View style={[styles.divider, styles.dividerRight]}></View>
<Text style={styles.or}>또는</Text>
</View>
</View>
);
};
function login(){
fetch('http://192.168.123.107:3000/api/data')
.then(response => response.json())
.then(json => console.log(json.message))
.catch(error => console.error('Error fetching data:', error));
}
const styles = StyleSheet.create({
body: {
margin: 0,
padding: 0,
width: '100%',
height: '85%',
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#f0f0f0',
},
container: {
width: 393,
height: 852,
backgroundColor: 'white',
overflow: 'hidden',
justifyContent: 'flex-start',
alignItems: 'center',
position: 'relative',
},
loginButton: {
width: 286,
paddingVertical: 18,
paddingHorizontal: 0,
position: 'absolute',
top: '76%',
borderRadius: 8,
backgroundColor: '#0D7FFB',
},
loginButtonText: {
color: 'white',
fontFamily: 'SF Pro',
fontSize: 20,
fontWeight: '600',
textAlign: 'center',
},
signupButton: {
width: 286,
paddingVertical: 18,
paddingHorizontal: 0,
position: 'absolute',
top: '89%',
borderRadius: 8,
backgroundColor: 'white',
borderWidth: 1,
borderColor: '#0075FF',
},
signupButtonText: {
color: '#0D7FFB',
fontFamily: 'SF Pro',
fontSize: 20,
fontWeight: '600',
textAlign: 'center',
},
alreadyMember: {
position: 'absolute',
top: '72%',
textAlign: 'center',
color: 'black',
fontSize: 14,
fontFamily: 'SF Pro',
fontWeight: '600',
},
divider: {
width: '40%',
position: 'absolute',
borderWidth: 1,
borderColor: '#868686',
},
dividerLeft: {
top: '86%',
left: '5%',
},
dividerRight: {
top: '86%',
left: '55%',
},
or: {
position: 'absolute',
top: '84.8%',
left: '47.4%',
textAlign: 'center',
color: '#868686',
fontSize: 13,
fontFamily: 'SF Pro',
fontWeight: '600',
},
});
export default App;