npm install @react-navigation/bottom-tabs
import React from 'react';
import { NavigationContainer } from '@react-navigation/native';
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
import { MaterialIcons } from '@expo/vector-icons';
import HomeScreen from './screens/HomeScreen';
import FormationScreen from './screens/FormationScreen';
import QuizScreen from './screens/QuizScreen';
import ProfileScreen from './screens/ProfileScreen';
const Tab = createBottomTabNavigator();
const App = () => {
return (
({
tabBarIcon: ({ color, size }) => {
let iconName;
if (route.name === 'Home') {
iconName = 'home';
} else if (route.name === 'Formation') {
iconName = 'school';
} else if (route.name === 'Quiz') {
iconName = 'quiz';
} else if (route.name === 'Profile') {
iconName = 'person';
}
return ;
},
})}
tabBarOptions={{
activeTintColor: '#2196F3',
inactiveTintColor: 'gray',
}}
>
);
};
export default App;
npm install react-native-video
import React from 'react';
import { StyleSheet, ScrollView, Text, Image } from 'react-native';
import Video from 'react-native-video';
const FormationScreen = () => {
return (
Chapitre 1: Rôles et responsabilités
Le SSIAP1 est responsable de la sécurité incendie dans les établissements recevant du public...
{/* Ajout d'une vidéo explicative */}
{/* Image explicative */}
);
};
export default FormationScreen;
const styles = StyleSheet.create({
container: {
padding: 20,
},
heading: {
fontSize: 22,
fontWeight: 'bold',
marginBottom: 10,
},
content: {
fontSize: 16,
marginBottom: 20,
},
video: {
height: 200,
width: '100%',
marginBottom: 20,
},
image: {
height: 150,
width: '100%',
marginBottom: 20,
},
});
import React, { useState } from 'react';
import { StyleSheet, Text, View, Button, ScrollView } from 'react-native';
const QuizScreen = () => {
const [score, setScore] = useState(0);
const [questionIndex, setQuestionIndex] = useState(0);
const [completed, setCompleted] = useState(false);
const questions = [
{
question: 'Quelle est la classe des feux d’origine électrique?',
options: ['A', 'B', 'C', 'E'],
answer: 'E'
},
{
question: 'Que signifie SSIAP?',
options: ['Système de Sécurité Incendie', 'Service de Sécurité Incendie et d\'Assistance à Personnes'],
answer: 'Service de Sécurité Incendie et d\'Assistance à Personnes'
}
];
const handleAnswer = (selectedOption) => {
if (selectedOption === questions[questionIndex].answer) {
setScore(score + 1);
}
if (questionIndex < questions.length - 1) {
setQuestionIndex(questionIndex + 1);
} else {
setCompleted(true);
}
};
const resetQuiz = () => {
setScore(0);
setQuestionIndex(0);
setCompleted(false);
};
if (completed) {
return (
Quiz terminé! Votre score: {score}/{questions.length}
);
}
return (
{questions[questionIndex].question}
{questions[questionIndex].options.map((option, index) => (
);
};
export default QuizScreen;
const styles = StyleSheet.create({
container: {
padding: 20,
justifyContent: 'center',
},
question: {
fontSize: 18,
marginBottom: 20,
},
result: {
fontSize: 20,
fontWeight: 'bold',
marginBottom: 20,
},
});
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
const ProfileScreen = () => {
return (
Profil Utilisateur
Nom: John Doe
Formation: SSIAP1
Progression: 75%
Score total des quiz: 85%
);
};
export default ProfileScreen;
const styles = StyleSheet.create({
container: {
padding: 20,
},
title: {
fontSize: 24,
fontWeight: 'bold',
marginBottom: 20,
},
label: {
fontSize: 18,
marginBottom: 10,
},
});
npm install react-native-push-notification