-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
172 lines (149 loc) · 5.13 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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
import { StatusBar } from 'expo-status-bar';
import { Image, TouchableOpacity, StyleSheet, Text, View, Dimensions, ActivityIndicator } from 'react-native';
import Register from './pages/register/Register';
import Login from './pages/login/Login';
import Search from './pages/search/Search';
import Quiz from './pages/quizz/Quiz';
import List from './pages/list/List';
import Account from './pages/account/Account';
import Research from './pages/search/Research';
import AnimeDetails from './pages/animeDetails/AnimeDetails';
import Navbar from './composants/navigation/Navbar';
import Mcq from './pages/quizz/Mcq';
import Recommendation from './pages/quizz/Recommendation';
import { NavigationContainer } from '@react-navigation/native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import React, { useState,useEffect} from 'react';
import * as Font from 'expo-font'; // Importez Font à partir de 'expo-font'
import { ActiveTabProvider } from "./contexts/ActiveTabContext";
const Stack = createNativeStackNavigator();
export default function App() {
const [fontsLoaded, setFontsLoaded] = useState(false);
const loadFonts = async () => {
await Font.loadAsync({
'Montserrat-Bold': require('./assets/fonts/static/Montserrat-Bold.ttf'),
'Montserrat-SemiBold': require('./assets/fonts/static/Montserrat-SemiBold.ttf'),
'Montserrat-Medium': require('./assets/fonts/static/Montserrat-Medium.ttf'),
'Montserrat-Regular': require('./assets/fonts/static/Montserrat-Regular.ttf'),
'Nuku': require('./assets/fonts/nuku1.ttf'),
});
setFontsLoaded(true);
};
useEffect(() => {
loadFonts()
}, []);
if (!fontsLoaded) {
return (
<ActivityIndicator size="large" />
);
}
return (
<ActiveTabProvider>
<NavigationContainer>
<Stack.Navigator
initialRouteName="Home"
screenOptions={{ headerShown: false }} // Cacher la barre d'en-tête pour tous les écrans
>
<Stack.Screen name="Home" component={HomeScreen} />
<Stack.Screen name="Register" component={Register} />
<Stack.Screen name="Login" component={Login} />
<Stack.Screen name="Search" component={Search} />
<Stack.Screen name="Quiz" component={Quiz} />
<Stack.Screen name="List" component={List} />
<Stack.Screen name="Account" component={Account} />
<Stack.Screen name="Research" component={Research} />
<Stack.Screen name="AnimeDetails" component={AnimeDetails} />
<Stack.Screen name="Mcq" component={Mcq} />
<Stack.Screen name="Recommendation" component={Recommendation} />
</Stack.Navigator>
<View>
<Navbar/>
</View>
</NavigationContainer>
</ActiveTabProvider>
);
}
function HomeScreen({ navigation }) {
return (
<View style={styles.container}>
<Image
style={styles.stretch}
source={require('./assets/img/BG_Bienvenue.png')} />
<View style={styles.centeredContent}>
<Image style={styles.icon} source={require('./assets/icon/Icon_BreakAnime.png')} />
<Text style={styles.titre}>Bienvenue</Text>
<Text style={[styles.text, styles.textMargin]}>{`Découvrez de nouveaux animes \n et ne vous perdez plus \n dans le suivi des épisodes !`}</Text>
</View>
<StatusBar style="auto" />
<TouchableOpacity style={[styles.button, styles.loginButton]} onPress={() => navigation.navigate('Login')}>
<Text style={styles.btnText}>Connexion</Text>
</TouchableOpacity>
<TouchableOpacity style={[styles.button, styles.registerButton]} onPress={() => navigation.navigate('Register')}>
<Text style={styles.btnText}>S'inscrire</Text>
</TouchableOpacity>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#0B0B0B',
alignItems: 'center',
justifyContent: 'center',
},
stretch: {
width: Dimensions.get('window').width, // largeur de l'écran
position: 'absolute', // position fixe
top: 40, // fixée en haut
height: 418, // hauteur de l'image
resizeMode: 'cover',
},
centeredContent: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
},
icon: {
width: 60, // Largeur de l'image
resizeMode: 'contain', // Assure que l'image est redimensionnée correctement
},
titre: {
color: '#FEC200',
fontSize: 36,
fontFamily: 'Nuku'
},
text: {
color: '#fff',
fontSize: 18,
fontFamily: 'Montserrat-Regular',
textAlign: 'center',
},
textMargin: {
marginTop: 16, // Espacement entre le titre et le texte
},
button: {
width: 295,
height: 43,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#fff',
borderRadius: 8,
marginBottom: 16,
},
loginButton: {
position: 'absolute',
bottom: 141,
},
registerButton: {
backgroundColor: '#FEC200',
position: 'absolute',
bottom: 82,
borderColor: '#fff', // Couleur du contour
borderWidth: 0.6, // Épaisseur du contour
},
btnText: {
color: '#0B0B0B',
fontSize: 18,
fontFamily: 'Montserrat-Bold',
},
});