-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
120 lines (115 loc) · 2.98 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
import * as React from 'react';
import { TouchableOpacity, View, Text, StyleSheet, ImageBackground } from 'react-native';
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
import LinearGradient from 'react-native-linear-gradient';
import Icon from 'react-native-vector-icons/Ionicons';
import Quiz from './components/Quiz';
import backgroundImage from './assets/background.jpg'; // Import the image
const Stack = createStackNavigator();
function HomeScreen({ navigation }) {
return (
<ImageBackground
source={backgroundImage} // Use the imported image here
style={styles.background}
>
<LinearGradient
colors={['rgba(0, 0, 0, 0.8)', 'rgba(0, 0, 0, 0.3)']}
style={styles.overlay}
>
<View style={styles.container}>
<Text style={styles.title}>Quiz Master</Text>
<Text style={styles.subtitle}>Test your knowledge</Text>
<TouchableOpacity
style={styles.button}
onPress={() => navigation.navigate('Quiz')}
>
<Icon name="play" size={24} color="#fff" style={styles.icon} />
<Text style={styles.buttonText}>Start Quiz</Text>
</TouchableOpacity>
</View>
</LinearGradient>
</ImageBackground>
);
}
function App() {
return (
<NavigationContainer>
<Stack.Navigator initialRouteName="Home">
<Stack.Screen
name="Home"
component={HomeScreen}
options={{ headerShown: false }}
/>
<Stack.Screen
name="Quiz"
component={Quiz}
options={{
title: 'Quiz',
headerStyle: {
backgroundColor: '#6200EE',
},
headerTintColor: '#fff',
headerTitleStyle: {
fontWeight: 'bold',
},
}}
/>
</Stack.Navigator>
</NavigationContainer>
);
}
const styles = StyleSheet.create({
background: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
},
overlay: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
width: '100%',
paddingHorizontal: 20,
},
container: {
alignItems: 'center',
},
title: {
fontSize: 48,
fontWeight: 'bold',
color: '#fff',
textShadowColor: 'rgba(0, 0, 0, 0.75)',
textShadowOffset: { width: -2, height: 2 },
textShadowRadius: 10,
marginBottom: 10,
},
subtitle: {
fontSize: 18,
color: '#fff',
marginBottom: 30,
},
button: {
flexDirection: 'row',
alignItems: 'center',
backgroundColor: '#03DAC6',
paddingVertical: 15,
paddingHorizontal: 30,
borderRadius: 30,
shadowColor: '#000',
shadowOffset: { width: 0, height: 5 },
shadowOpacity: 0.5,
shadowRadius: 10,
elevation: 5,
},
buttonText: {
fontSize: 20,
color: '#fff',
fontWeight: '600',
marginLeft: 10,
},
icon: {
marginRight: 10,
},
});
export default App;