From d280d5089ed626f88c02b663b9c8f40b630a2c5e Mon Sep 17 00:00:00 2001
From: Pierre Ferreira
Date: Wed, 8 Feb 2023 12:06:10 +0100
Subject: [PATCH] =?UTF-8?q?:zap:=20Ajout=20de=20la=20StackNavigation=20qui?=
=?UTF-8?q?=20marche=20avec=20la=20BottomNavigation=20et=20cr=C3=A9ation?=
=?UTF-8?q?=20de=20zones=20d'item=20en=20fonction=20d'une=20liste=20:zap:?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
App.tsx | 4 +++
navigation/Navigation.tsx | 9 +++--
navigation/StackNavigation.tsx | 5 ++-
screens/HomeScreen.tsx | 60 ++++++++++++++++++++++++----------
screens/ListScreen.tsx | 48 +++++++++++++++++++++++++++
5 files changed, 103 insertions(+), 23 deletions(-)
diff --git a/App.tsx b/App.tsx
index 99a4052..453b082 100644
--- a/App.tsx
+++ b/App.tsx
@@ -1,7 +1,11 @@
import { StatusBar } from 'expo-status-bar';
import { StyleSheet, Text, View, Button } from 'react-native';
import React, { useState } from "react";
+
import Navigation from './navigation/Navigation';
+import StackNavigation from './navigation/StackNavigation';
+
+import { createStackNavigator } from '@react-navigation/stack';
import {
SafeAreaView,
diff --git a/navigation/Navigation.tsx b/navigation/Navigation.tsx
index dae5f3a..d2d0ce9 100644
--- a/navigation/Navigation.tsx
+++ b/navigation/Navigation.tsx
@@ -10,6 +10,7 @@ import ListScreen from '../screens/ListScreen';
import ListFav from '../screens/ListFav';
import TabBarIcon from '../components/TabBarIcon';
+import StackNavigation from './StackNavigation';
@@ -24,14 +25,16 @@ export default function Navigation() {
title: 'List',
tabBarIcon: ({color}) => ,
}}/>
- ,
- }}/>
+ headerShown: false
+ }}
+ />
,
}}/>
diff --git a/navigation/StackNavigation.tsx b/navigation/StackNavigation.tsx
index 21744cb..3c63f32 100644
--- a/navigation/StackNavigation.tsx
+++ b/navigation/StackNavigation.tsx
@@ -8,16 +8,15 @@ import HomeScreen from '../screens/HomeScreen';
import ListScreen from '../screens/ListScreen';
import ListFav from '../screens/ListFav';
-
export default function StackNavigation() {
const Stack = createStackNavigator();
return (
-
+ //
-
+ //
)
}
\ No newline at end of file
diff --git a/screens/HomeScreen.tsx b/screens/HomeScreen.tsx
index 21f05fa..9255c15 100644
--- a/screens/HomeScreen.tsx
+++ b/screens/HomeScreen.tsx
@@ -1,27 +1,39 @@
-import { StyleSheet, Text, View, Button, TouchableNativeFeedback } from 'react-native';
+import { StyleSheet, Text, View, TouchableNativeFeedback } from 'react-native';
import { useNavigation } from '@react-navigation/native';
import { NavigationContainer } from '@react-navigation/native';
import StackNavigation from '../navigation/StackNavigation'
import { Colors } from 'react-native/Libraries/NewAppScreen';
-export default function HomeScreen() {
+import Button from 'react-bootstrap/Button';
+
+// @ts-ignore //(ta gueule pour l'erreur sur navigation)
+export default function HomeScreen({navigation}) {
return (
- //
- // navigation.navigate("ListScreen")}>
- //Click me !
- //
-
-
- Mes super Nounours !
-
- Mon super texte ...
- {/* */}
-
- Nous sommes actuellement dans l'écran d'accueil !
-
+
+
+ Mes super Nounours !
+
+ Mon super texte ...
+ {/* */}
+
+ Nous sommes actuellement dans l'écran d'accueil !
+
+
+
+ Vous cherchez une entités ?
+ navigation.navigate("ListScreen")}>
+ Consulter la liste global !
+
+
+
+
+ Vous avez des entités favorites ?
+ navigation.navigate("ListFav")}>
+ Aller sur la page de favoris !
+
- //
+
)
};
@@ -35,7 +47,8 @@ export default function HomeScreen() {
alignItems: "center"
},
title: {
- fontSize: 20
+ fontSize: 20,
+ fontWeight: 'bold',
},
MidArea: {
justifyContent: "center",
@@ -43,9 +56,22 @@ export default function HomeScreen() {
paddingTop: 50,
paddingBottom: 50,
margin: 40,
+ borderRadius: 15,
},
textStyle: {
textAlign: "center",
fontSize: 20,
+ },
+ ButtonStyle :{
+ backgroundColor: "#2E8AE6",
+ borderRadius: 15,
+ padding: 20,
+ color: "white",
+ fontSize : 20,
+ fontWeight: 'bold',
+ },
+ t3 :{
+ fontSize : 20,
+ fontWeight: 'bold',
}
});
diff --git a/screens/ListScreen.tsx b/screens/ListScreen.tsx
index bc68ccb..e7e5192 100644
--- a/screens/ListScreen.tsx
+++ b/screens/ListScreen.tsx
@@ -2,6 +2,42 @@
import { StyleSheet, Text, View, Button } from 'react-native';
import { StatusBar } from 'expo-status-bar';
import React, { useState } from "react";
+import { FlatList } from 'react-native-gesture-handler';
+
+
+export const DATA = [
+ {
+ id: '1',
+ title: "premier élément",
+ },
+ {
+ id: '2',
+ title: "second élément",
+ },
+ {
+ id: '3',
+ title: "élément",
+ },
+ {
+ id: '4',
+ title: "Rick",
+ },
+ {
+ id: '5',
+ title: "Corentin",
+ },
+ {
+ id: '10',
+ title: "dernier élément",
+ },
+];
+
+//@ts-ignore
+const Item = ({title}) => (
+
+ {title}
+
+);
export default function Main(){
@@ -14,6 +50,9 @@ export default function Main(){
{count}
+ }
+ keyExtractor={item => item.id}/>
);
}
@@ -38,5 +77,14 @@ const styles = StyleSheet.create({
borderColor : '#00ffaa',
alignItems: 'center',
justifyContent: 'center',
+ },
+ item: {
+ borderRadius : 15,
+ backgroundColor: '#efefef',
+ padding: 20,
+ margin : 10,
+ },
+ title: {
+ fontStyle: "italic",
}
});