-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLogIn.js
More file actions
46 lines (44 loc) · 1.33 KB
/
LogIn.js
File metadata and controls
46 lines (44 loc) · 1.33 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
import * as React from 'react';
import { useState } from 'react';
import {
View,
SafeAreaView,
TextInput,
TouchableOpacity,
Text,
} from 'react-native';
import { handleLogin } from './utils/accountUtils';
import styles from './components/styles/Login.styles';
export default function LoginScreen({ navigation }) {
const [username, setUsername] = useState('');
const [password, setPassword] = useState('');
const ref2 = React.useRef(null);
return (
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
<SafeAreaView style={styles.container}>
<TextInput
placeholder="Username"
value={username}
onChangeText={(text) => setUsername(text)}
style={styles.TextInput}
onSubmitEditing={() => ref2.current.focus()}
/>
<TextInput
ref={ref2}
placeholder="Password"
value={password}
onChangeText={(text) => setPassword(text)}
secureTextEntry
style={styles.TextInput}
/>
<TouchableOpacity
style={styles.TouchableOpacity}
onPress={() => handleLogin(username, password, navigation)}
color="#841584"
>
<Text style={styles.TouchableOpacityText}>Log In</Text>
</TouchableOpacity>
</SafeAreaView>
</View>
);
}