-
Notifications
You must be signed in to change notification settings - Fork 3
/
Home.js
56 lines (54 loc) · 1.23 KB
/
Home.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
import React from 'react';
import { StyleSheet, Text, View, Pressable, Dimensions } from 'react-native';
import { Auth } from 'aws-amplify';
const { width } = Dimensions.get('window');
const Home = () => {
const signOut = async () => {
try {
await Auth.signOut();
} catch (error) {
console.log('error signing out: ', error);
}
};
return (
<View style={styles.container}>
<View style={styles.header}>
<Text style={styles.headerText}>Welcome!</Text>
<Pressable style={styles.button} onPress={() => signOut()}>
<Text style={styles.buttonText}>Sign out</Text>
</Pressable>
</View>
</View>
);
};
const styles = StyleSheet.create({
container: {
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
width: width,
paddingVertical: 20,
},
header: {
display: 'flex',
flexDirection: 'row',
justifyContent: 'space-between',
padding: 20,
width: width,
alignItems: 'center',
},
headerText: {
fontSize: 28,
fontWeight: 'bold',
},
button: {
backgroundColor: '#ff9900',
padding: 10,
borderRadius: 6,
},
buttonText: {
color: '#fff',
fontSize: 18,
},
});
export default Home;