-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHome.js
73 lines (68 loc) · 1.83 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import React, { useState, useEffect } from 'react';
import { StyleSheet, Text, View, ActivityIndicator, TouchableOpacity } from 'react-native';
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#f0f0f0', // Light gray background
alignItems: 'center',
justifyContent: 'center',
},
loadingContainer: {
position: 'absolute',
top: 0,
left: 0,
right: 0,
bottom: 0,
backgroundColor: 'rgba(255, 255, 255, 0.7)', // Slightly transparent white
alignItems: 'center',
justifyContent: 'center',
zIndex: 1,
},
loadingText: {
fontFamily: 'ProximaNova-Regular',
fontSize: 24,
fontWeight: 'bold',
marginTop: 20,
color: '#333', // Dark gray text
},
playButton: {
backgroundColor: '#f8755a', // Orange background
paddingHorizontal: 40,
paddingVertical: 20,
borderRadius: 10,
},
playButtonText: {
fontFamily: 'ProximaNova-Regular',
color: 'white',
fontSize: 24,
fontWeight: 'bold',
},
});
export default function Home({ navigation }) {
const [loading, setLoading] = useState(true);
useEffect(() => {
// Simulate loading time
setTimeout(() => {
setLoading(false);
}, 2000); // Adjust the duration as needed
// Cleanup
return () => clearTimeout();
}, []);
return (
<View style={styles.container}>
{loading ? (
<View style={styles.loadingContainer}>
<ActivityIndicator size="large" color="#f8755a" />
<Text style={styles.loadingText}>Loading...</Text>
</View>
) : (
<TouchableOpacity
onPress={() => navigation.navigate('InstructThrow')} // Navigate to the game screen
style={styles.playButton}
>
<Text style={styles.playButtonText}>Play iAmAngry</Text>
</TouchableOpacity>
)}
</View>
);
}