From 98ff4ba4671baa0f7d116bbb6a2b0e8940bca9d4 Mon Sep 17 00:00:00 2001 From: Maxence Lanone Date: Sun, 5 Mar 2023 11:26:53 +0100 Subject: [PATCH 1/3] :build: stack nav marche pas avec erreur --- App.tsx | 4 +- package-lock.json | 136 +++++++++++++++++++++++++++++-- package.json | 1 + src/components/NavBar.tsx | 2 +- src/components/WidgetMeteo.tsx | 33 ++++---- src/navigator/Navigator.tsx | 11 +-- src/navigator/StackNavigator.tsx | 21 +++++ src/screen/DetailCity.tsx | 47 +++++++++++ src/screen/DetailMeteo.tsx | 65 --------------- src/screen/HomePage.tsx | 60 ++++++++++++++ yarn.lock | 54 ++++++++++-- 11 files changed, 333 insertions(+), 101 deletions(-) create mode 100644 src/navigator/StackNavigator.tsx create mode 100644 src/screen/DetailCity.tsx delete mode 100644 src/screen/DetailMeteo.tsx create mode 100644 src/screen/HomePage.tsx diff --git a/App.tsx b/App.tsx index 96a44fa..03e43d9 100644 --- a/App.tsx +++ b/App.tsx @@ -1,8 +1,6 @@ import { StatusBar } from 'expo-status-bar'; import { SafeAreaView, StyleSheet, Text, View } from 'react-native'; -import Meteo from './src/screen/Meteo'; -import NavBar from './src/components/NavBar'; -import DetailMeteo from './src/screen/DetailMeteo'; +import HomePage from './src/screen/HomePage'; import MainTab from './src/navigator/Navigator'; diff --git a/package-lock.json b/package-lock.json index 9ad9a6f..b006da1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,6 +10,7 @@ "dependencies": { "@react-navigation/bottom-tabs": "^6.5.4", "@react-navigation/native": "^6.1.3", + "@react-navigation/stack": "^6.3.16", "expo": "~47.0.12", "expo-status-bar": "~1.4.2", "react": "18.1.0", @@ -1785,6 +1786,18 @@ "node": ">=6.9.0" } }, + "node_modules/@egjs/hammerjs": { + "version": "2.0.17", + "resolved": "https://registry.npmjs.org/@egjs/hammerjs/-/hammerjs-2.0.17.tgz", + "integrity": "sha512-XQsZgjm2EcVUiZQf11UBJQfmZeEmOW8DpI1gsFeln6w0ae0ii4dMQEQ0kjl6DspdWX1aGY1/loyXnP0JS06e/A==", + "peer": true, + "dependencies": { + "@types/hammerjs": "^2.0.36" + }, + "engines": { + "node": ">=0.8.0" + } + }, "node_modules/@expo/bunyan": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/@expo/bunyan/-/bunyan-4.0.0.tgz", @@ -4562,9 +4575,9 @@ "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==" }, "node_modules/@react-navigation/elements": { - "version": "1.3.14", - "resolved": "https://registry.npmjs.org/@react-navigation/elements/-/elements-1.3.14.tgz", - "integrity": "sha512-RBbPhYq+KNFPAkWPaHB9gypq0jTGp/0fkMwRLToJ8jkLtWG4LV+JoQ/erFQnVARkR3Q807n0VnES15EYP4ITMQ==", + "version": "1.3.17", + "resolved": "https://registry.npmjs.org/@react-navigation/elements/-/elements-1.3.17.tgz", + "integrity": "sha512-sui8AzHm6TxeEvWT/NEXlz3egYvCUog4tlXA4Xlb2Vxvy3purVXDq/XsM56lJl344U5Aj/jDzkVanOTMWyk4UA==", "peerDependencies": { "@react-navigation/native": "^6.0.0", "react": "*", @@ -4606,6 +4619,24 @@ "nanoid": "^3.1.23" } }, + "node_modules/@react-navigation/stack": { + "version": "6.3.16", + "resolved": "https://registry.npmjs.org/@react-navigation/stack/-/stack-6.3.16.tgz", + "integrity": "sha512-KTOn9cNuZ6p154Htbl2DiR95Wl+c7niLPRiGs7gjOkyVDGiaGQF9ODNQTYBDE1OxZGHe/EyYc6T2CbmiItLWDg==", + "dependencies": { + "@react-navigation/elements": "^1.3.17", + "color": "^4.2.3", + "warn-once": "^0.1.0" + }, + "peerDependencies": { + "@react-navigation/native": "^6.0.0", + "react": "*", + "react-native": "*", + "react-native-gesture-handler": ">= 1.0.0", + "react-native-safe-area-context": ">= 3.0.0", + "react-native-screens": ">= 3.0.0" + } + }, "node_modules/@segment/loosely-validate-event": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/@segment/loosely-validate-event/-/loosely-validate-event-2.0.0.tgz", @@ -4638,6 +4669,12 @@ "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.25.21.tgz", "integrity": "sha512-gFukHN4t8K4+wVC+ECqeqwzBDeFeTzBXroBTqE6vcWrQGbEUpHO7LYdG0f4xnvYq4VOEwITSlHlp0JBAIFMS/g==" }, + "node_modules/@types/hammerjs": { + "version": "2.0.41", + "resolved": "https://registry.npmjs.org/@types/hammerjs/-/hammerjs-2.0.41.tgz", + "integrity": "sha512-ewXv/ceBaJprikMcxCmWU1FKyMAQ2X7a9Gtmzw8fcg2kIePI1crERDM818W+XYrxqdBBOdlf2rm137bU+BltCA==", + "peer": true + }, "node_modules/@types/istanbul-lib-coverage": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz", @@ -7437,6 +7474,21 @@ "node": ">=8" } }, + "node_modules/hoist-non-react-statics": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz", + "integrity": "sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==", + "peer": true, + "dependencies": { + "react-is": "^16.7.0" + } + }, + "node_modules/hoist-non-react-statics/node_modules/react-is": { + "version": "16.13.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", + "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==", + "peer": true + }, "node_modules/hosted-git-info": { "version": "3.0.8", "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-3.0.8.tgz", @@ -10543,6 +10595,23 @@ "nullthrows": "^1.1.1" } }, + "node_modules/react-native-gesture-handler": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/react-native-gesture-handler/-/react-native-gesture-handler-2.9.0.tgz", + "integrity": "sha512-a0BcH3Qb1tgVqUutc6d3VuWQkI1AM3+fJx8dkxzZs9t06qA27QgURYFoklpabuWpsUTzuKRpxleykp25E8m7tg==", + "peer": true, + "dependencies": { + "@egjs/hammerjs": "^2.0.17", + "hoist-non-react-statics": "^3.3.0", + "invariant": "^2.2.4", + "lodash": "^4.17.21", + "prop-types": "^15.7.2" + }, + "peerDependencies": { + "react": "*", + "react-native": "*" + } + }, "node_modules/react-native-gradle-plugin": { "version": "0.70.3", "resolved": "https://registry.npmjs.org/react-native-gradle-plugin/-/react-native-gradle-plugin-0.70.3.tgz", @@ -13984,6 +14053,15 @@ "to-fast-properties": "^2.0.0" } }, + "@egjs/hammerjs": { + "version": "2.0.17", + "resolved": "https://registry.npmjs.org/@egjs/hammerjs/-/hammerjs-2.0.17.tgz", + "integrity": "sha512-XQsZgjm2EcVUiZQf11UBJQfmZeEmOW8DpI1gsFeln6w0ae0ii4dMQEQ0kjl6DspdWX1aGY1/loyXnP0JS06e/A==", + "peer": true, + "requires": { + "@types/hammerjs": "^2.0.36" + } + }, "@expo/bunyan": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/@expo/bunyan/-/bunyan-4.0.0.tgz", @@ -16123,9 +16201,9 @@ } }, "@react-navigation/elements": { - "version": "1.3.14", - "resolved": "https://registry.npmjs.org/@react-navigation/elements/-/elements-1.3.14.tgz", - "integrity": "sha512-RBbPhYq+KNFPAkWPaHB9gypq0jTGp/0fkMwRLToJ8jkLtWG4LV+JoQ/erFQnVARkR3Q807n0VnES15EYP4ITMQ==", + "version": "1.3.17", + "resolved": "https://registry.npmjs.org/@react-navigation/elements/-/elements-1.3.17.tgz", + "integrity": "sha512-sui8AzHm6TxeEvWT/NEXlz3egYvCUog4tlXA4Xlb2Vxvy3purVXDq/XsM56lJl344U5Aj/jDzkVanOTMWyk4UA==", "requires": {} }, "@react-navigation/native": { @@ -16154,6 +16232,16 @@ "nanoid": "^3.1.23" } }, + "@react-navigation/stack": { + "version": "6.3.16", + "resolved": "https://registry.npmjs.org/@react-navigation/stack/-/stack-6.3.16.tgz", + "integrity": "sha512-KTOn9cNuZ6p154Htbl2DiR95Wl+c7niLPRiGs7gjOkyVDGiaGQF9ODNQTYBDE1OxZGHe/EyYc6T2CbmiItLWDg==", + "requires": { + "@react-navigation/elements": "^1.3.17", + "color": "^4.2.3", + "warn-once": "^0.1.0" + } + }, "@segment/loosely-validate-event": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/@segment/loosely-validate-event/-/loosely-validate-event-2.0.0.tgz", @@ -16186,6 +16274,12 @@ "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.25.21.tgz", "integrity": "sha512-gFukHN4t8K4+wVC+ECqeqwzBDeFeTzBXroBTqE6vcWrQGbEUpHO7LYdG0f4xnvYq4VOEwITSlHlp0JBAIFMS/g==" }, + "@types/hammerjs": { + "version": "2.0.41", + "resolved": "https://registry.npmjs.org/@types/hammerjs/-/hammerjs-2.0.41.tgz", + "integrity": "sha512-ewXv/ceBaJprikMcxCmWU1FKyMAQ2X7a9Gtmzw8fcg2kIePI1crERDM818W+XYrxqdBBOdlf2rm137bU+BltCA==", + "peer": true + }, "@types/istanbul-lib-coverage": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz", @@ -18354,6 +18448,23 @@ "source-map": "^0.7.3" } }, + "hoist-non-react-statics": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz", + "integrity": "sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==", + "peer": true, + "requires": { + "react-is": "^16.7.0" + }, + "dependencies": { + "react-is": { + "version": "16.13.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", + "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==", + "peer": true + } + } + }, "hosted-git-info": { "version": "3.0.8", "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-3.0.8.tgz", @@ -20741,6 +20852,19 @@ "nullthrows": "^1.1.1" } }, + "react-native-gesture-handler": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/react-native-gesture-handler/-/react-native-gesture-handler-2.9.0.tgz", + "integrity": "sha512-a0BcH3Qb1tgVqUutc6d3VuWQkI1AM3+fJx8dkxzZs9t06qA27QgURYFoklpabuWpsUTzuKRpxleykp25E8m7tg==", + "peer": true, + "requires": { + "@egjs/hammerjs": "^2.0.17", + "hoist-non-react-statics": "^3.3.0", + "invariant": "^2.2.4", + "lodash": "^4.17.21", + "prop-types": "^15.7.2" + } + }, "react-native-gradle-plugin": { "version": "0.70.3", "resolved": "https://registry.npmjs.org/react-native-gradle-plugin/-/react-native-gradle-plugin-0.70.3.tgz", diff --git a/package.json b/package.json index d7afeb9..26d8caa 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "dependencies": { "@react-navigation/bottom-tabs": "^6.5.4", "@react-navigation/native": "^6.1.3", + "@react-navigation/stack": "^6.3.16", "expo": "~47.0.12", "expo-status-bar": "~1.4.2", "react": "18.1.0", diff --git a/src/components/NavBar.tsx b/src/components/NavBar.tsx index a74c8ce..d39d51c 100644 --- a/src/components/NavBar.tsx +++ b/src/components/NavBar.tsx @@ -3,7 +3,7 @@ import { TabBarIOSItem, Text, View } from 'react-native'; import { NavigationContainer } from '@react-navigation/native'; import { createBottomTabNavigator } from '@react-navigation/bottom-tabs'; -import DetailMeteo from "../screen/DetailMeteo"; +import DetailMeteo from "../screen/HomePage"; function HomeScreen() { return ( diff --git a/src/components/WidgetMeteo.tsx b/src/components/WidgetMeteo.tsx index 55b8e48..0ad89c5 100644 --- a/src/components/WidgetMeteo.tsx +++ b/src/components/WidgetMeteo.tsx @@ -1,27 +1,29 @@ import React from 'react'; -import { StyleSheet, Text, View, Image, TouchableOpacity, ImageBackground } from 'react-native'; +import { StyleSheet, Text, View, Image, TouchableOpacity, ImageBackground, Pressable } from 'react-native'; import { City, Weather, CITIES_DATA, FAVORITE_CITY_DATA, getCurrentWeather } from '../../data/stub'; import { useNavigation } from '@react-navigation/native'; -import {Dimensions} from 'react-native'; +import { Dimensions } from 'react-native'; type WidgetMeteoProps = { item: Weather; } - -export default function WidgetMeteo(props : WidgetMeteoProps) { + +export default function WidgetMeteo(props: WidgetMeteoProps) { const windowWidth = Dimensions.get('window').width; -return ( + return ( + + + + + {props.item.city.name} + {props.item.temperature} °C + - - + - {props.item.city.name} - {props.item.temperature} °C - - -) + ) } const styles = StyleSheet.create({ @@ -49,7 +51,7 @@ const styles = StyleSheet.create({ fontSize: 20, fontWeight: "bold", textShadowColor: 'rgba(0, 0, 0, 0.75)', - textShadowOffset: {width: -1, height: 1}, + textShadowOffset: { width: -1, height: 1 }, textShadowRadius: 10 }, textTemp: { @@ -57,9 +59,8 @@ const styles = StyleSheet.create({ fontSize: 40, fontWeight: "bold", textShadowColor: 'rgba(0, 0, 0, 0.75)', - textShadowOffset: {width: -1, height: 1}, + textShadowOffset: { width: -1, height: 1 }, textShadowRadius: 10 }, }); - - \ No newline at end of file + diff --git a/src/navigator/Navigator.tsx b/src/navigator/Navigator.tsx index 017f9ea..0797ed6 100644 --- a/src/navigator/Navigator.tsx +++ b/src/navigator/Navigator.tsx @@ -1,13 +1,15 @@ import { NavigationContainer } from "@react-navigation/native"; import { createBottomTabNavigator } from "@react-navigation/bottom-tabs"; +import { createStackNavigator } from "@react-navigation/stack"; import { View } from "react-native"; import * as React from "react"; import { FontAwesome } from "@expo/vector-icons"; -import DetailMeteo from "../screen/DetailMeteo"; -import Meteo from "../screen/Meteo"; +import HomePage from "../screen/HomePage"; import AddCity from "../screen/AddCity"; import Settings from "../screen/Settings"; +import StackNavigator from "./StackNavigator"; const Tab = createBottomTabNavigator(); +const Stack = createStackNavigator(); export default function MainTab() { return ( @@ -15,12 +17,12 @@ export default function MainTab() { - }} /> - @@ -35,7 +37,6 @@ export default function MainTab() { title: 'Settings', tabBarIcon: ({ color }) => }} /> - ) diff --git a/src/navigator/StackNavigator.tsx b/src/navigator/StackNavigator.tsx new file mode 100644 index 0000000..e8077c4 --- /dev/null +++ b/src/navigator/StackNavigator.tsx @@ -0,0 +1,21 @@ +import { NavigationContainer } from "@react-navigation/native"; +import { createBottomTabNavigator } from "@react-navigation/bottom-tabs"; +import { createStackNavigator } from "@react-navigation/stack"; +import { View } from "react-native"; +import * as React from "react"; +import HomePage from "../screen/HomePage"; +import DetailCity from "../screen/DetailCity"; +const Stack = createStackNavigator(); + +export default function StackNavigator() { + return ( + + + + + + + ) +} \ No newline at end of file diff --git a/src/screen/DetailCity.tsx b/src/screen/DetailCity.tsx new file mode 100644 index 0000000..a9afb70 --- /dev/null +++ b/src/screen/DetailCity.tsx @@ -0,0 +1,47 @@ +import { useState } from 'react'; +import { FlatList, Button, StyleSheet, Text, View, TextInput, Image } from 'react-native'; + +import { City, Weather, CITIES_DATA, FAVORITE_CITY_DATA, getCurrentWeather } from '../../data/stub'; +import CityListItem from '../components/CityListItem'; + +export default function DetailCity() { + + + return ( + + Test + + ); + +} + +const styles = StyleSheet.create({ + container: { + flex: 1, + justifyContent: 'center', + alignItems: 'center', + margin: 10, + }, + textInput: { + width: "90%" + + }, + searchBar: { + flexDirection: 'row', + justifyContent: 'center', + alignItems: 'center', + borderWidth: 0.5, + borderColor: '#000', + height: 40, + borderRadius: 10, + margin: 10, + }, + imageLoupe: { + padding: 10, + margin: 5, + height: 15, + width: 15, + resizeMode: 'stretch', + alignItems: 'center', + } +}); diff --git a/src/screen/DetailMeteo.tsx b/src/screen/DetailMeteo.tsx deleted file mode 100644 index 2fbac2a..0000000 --- a/src/screen/DetailMeteo.tsx +++ /dev/null @@ -1,65 +0,0 @@ -import { useState } from 'react'; -import { Button, FlatList, StyleSheet, Text, View, ImageBackground } from 'react-native'; -import { City, Weather, CITIES_DATA, FAVORITE_CITY_DATA, getCurrentWeather, WEATHER_DATA } from '../../data/stub'; -import WidgetMeteo from '../components/WidgetMeteo'; - -export default function DetailMeteo() { - - //City - const [meteo, setMeteo] = useState(new Weather("2023-01-22 09:55:59", 10000, "Nuageux", - "couvert", 20, -4.34, - 82, 5.14, 1032, - new City("Paris", 48.866667, 2.333333) - )); - - return ( - - <> - - - - - - ) -} - -const styles = StyleSheet.create({ - container: { - flex: 1, - width: '100%', - flexWrap: 'wrap', - flexDirection: 'row', - justifyContent: 'center', - alignItems: 'center', - - }, - flatList: { - flex: 2, - flexWrap: 'wrap', - flexDirection: 'row', - - }, - } -); - -/* -new Weather("2023-01-22 09:55:59", 10000, "Nuageux", - "couvert", 0.52, -4.34, - 82, 5.14, 1032, - new City("Paris", 48.866667, 2.333333) - )*/ - /* - export const apiUrlBuilder = (lieu: City) => { - if (lieu === undefined) return {}; - - } - export const getCurrentWeather = (cityName: string) => { - if (cityName === undefined) return {}; - return WEATHER_DATA.filter(elt => elt.city.name === cityName)[0]; - string url = 'https://api.open-meteo.com/v1/meteofrance?latitude='+45.75+'&longitude='+3.11+'&hourly=temperature_2m,relativehumidity_2m,apparent_temperature,surface_pressure,cloudcover,windspeed_10m&timeformat=unixtime&start_date='+2023-02-03+'&end_date='+2023-02-03+'&timezone=Europe%2FBerlin - - fetch(https://api.open-meteo.com/v1/meteofrance?latitude=45.75&longitude=3.11&hourly=temperature_2m,relativehumidity_2m,apparent_temperature,surface_pressure,cloudcover,windspeed_10m&timeformat=unixtime&start_date=2023-02-03&end_date=2023-02-03&timezone=Europe%2FBerlin - - const response = fetch(url); - const json = await response.json(); - }*/ \ No newline at end of file diff --git a/src/screen/HomePage.tsx b/src/screen/HomePage.tsx new file mode 100644 index 0000000..40c6c7a --- /dev/null +++ b/src/screen/HomePage.tsx @@ -0,0 +1,60 @@ +import { useState } from 'react'; +import { Button, FlatList, StyleSheet, Text, View, ImageBackground, TouchableHighlight, TouchableOpacity } from 'react-native'; +import { City, Weather, CITIES_DATA, FAVORITE_CITY_DATA, getCurrentWeather, WEATHER_DATA } from '../../data/stub'; +import WidgetMeteo from '../components/WidgetMeteo'; +import { useNavigation } from '@react-navigation/native'; +import { NavigationContainer, useRoute } from '@react-navigation/native'; + + +export default function HomePage({navigation}) { + return ( + <> + + navigation.navigate("DetailCity", {"weather": item})}> + + } keyExtractor={(item: Weather) => item.city.name} numColumns={2}> + + + ) +} + +const styles = StyleSheet.create({ + container: { + flex: 1, + width: '100%', + flexWrap: 'wrap', + flexDirection: 'row', + justifyContent: 'center', + alignItems: 'center', + + }, + flatList: { + flex: 2, + flexWrap: 'wrap', + flexDirection: 'row', + + }, +} +); + +/* +new Weather("2023-01-22 09:55:59", 10000, "Nuageux", + "couvert", 0.52, -4.34, + 82, 5.14, 1032, + new City("Paris", 48.866667, 2.333333) + )*/ +/* +export const apiUrlBuilder = (lieu: City) => { + if (lieu === undefined) return {}; + +} +export const getCurrentWeather = (cityName: string) => { + if (cityName === undefined) return {}; + return WEATHER_DATA.filter(elt => elt.city.name === cityName)[0]; + string url = 'https://api.open-meteo.com/v1/meteofrance?latitude='+45.75+'&longitude='+3.11+'&hourly=temperature_2m,relativehumidity_2m,apparent_temperature,surface_pressure,cloudcover,windspeed_10m&timeformat=unixtime&start_date='+2023-02-03+'&end_date='+2023-02-03+'&timezone=Europe%2FBerlin + +fetch(https://api.open-meteo.com/v1/meteofrance?latitude=45.75&longitude=3.11&hourly=temperature_2m,relativehumidity_2m,apparent_temperature,surface_pressure,cloudcover,windspeed_10m&timeformat=unixtime&start_date=2023-02-03&end_date=2023-02-03&timezone=Europe%2FBerlin + + const response = fetch(url); + const json = await response.json(); +}*/ \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 5558ce9..896a680 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1062,6 +1062,13 @@ "@babel/helper-validator-identifier" "^7.19.1" to-fast-properties "^2.0.0" +"@egjs/hammerjs@^2.0.17": + version "2.0.17" + resolved "https://registry.npmjs.org/@egjs/hammerjs/-/hammerjs-2.0.17.tgz" + integrity sha512-XQsZgjm2EcVUiZQf11UBJQfmZeEmOW8DpI1gsFeln6w0ae0ii4dMQEQ0kjl6DspdWX1aGY1/loyXnP0JS06e/A== + dependencies: + "@types/hammerjs" "^2.0.36" + "@expo/bunyan@^4.0.0", "@expo/bunyan@4.0.0": version "4.0.0" resolved "https://registry.npmjs.org/@expo/bunyan/-/bunyan-4.0.0.tgz" @@ -1742,10 +1749,10 @@ react-is "^16.13.0" use-latest-callback "^0.1.5" -"@react-navigation/elements@^1.3.14": - version "1.3.14" - resolved "https://registry.npmjs.org/@react-navigation/elements/-/elements-1.3.14.tgz" - integrity sha512-RBbPhYq+KNFPAkWPaHB9gypq0jTGp/0fkMwRLToJ8jkLtWG4LV+JoQ/erFQnVARkR3Q807n0VnES15EYP4ITMQ== +"@react-navigation/elements@^1.3.14", "@react-navigation/elements@^1.3.17": + version "1.3.17" + resolved "https://registry.npmjs.org/@react-navigation/elements/-/elements-1.3.17.tgz" + integrity sha512-sui8AzHm6TxeEvWT/NEXlz3egYvCUog4tlXA4Xlb2Vxvy3purVXDq/XsM56lJl344U5Aj/jDzkVanOTMWyk4UA== "@react-navigation/native@^6.0.0", "@react-navigation/native@^6.1.3": version "6.1.3" @@ -1764,6 +1771,15 @@ dependencies: nanoid "^3.1.23" +"@react-navigation/stack@^6.3.16": + version "6.3.16" + resolved "https://registry.npmjs.org/@react-navigation/stack/-/stack-6.3.16.tgz" + integrity sha512-KTOn9cNuZ6p154Htbl2DiR95Wl+c7niLPRiGs7gjOkyVDGiaGQF9ODNQTYBDE1OxZGHe/EyYc6T2CbmiItLWDg== + dependencies: + "@react-navigation/elements" "^1.3.17" + color "^4.2.3" + warn-once "^0.1.0" + "@segment/loosely-validate-event@^2.0.0": version "2.0.0" resolved "https://registry.npmjs.org/@segment/loosely-validate-event/-/loosely-validate-event-2.0.0.tgz" @@ -1794,6 +1810,11 @@ resolved "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.25.21.tgz" integrity sha512-gFukHN4t8K4+wVC+ECqeqwzBDeFeTzBXroBTqE6vcWrQGbEUpHO7LYdG0f4xnvYq4VOEwITSlHlp0JBAIFMS/g== +"@types/hammerjs@^2.0.36": + version "2.0.41" + resolved "https://registry.npmjs.org/@types/hammerjs/-/hammerjs-2.0.41.tgz" + integrity sha512-ewXv/ceBaJprikMcxCmWU1FKyMAQ2X7a9Gtmzw8fcg2kIePI1crERDM818W+XYrxqdBBOdlf2rm137bU+BltCA== + "@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0": version "2.0.4" resolved "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz" @@ -3651,6 +3672,13 @@ hermes-profile-transformer@^0.0.6: dependencies: source-map "^0.7.3" +hoist-non-react-statics@^3.3.0: + version "3.3.2" + resolved "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz" + integrity sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw== + dependencies: + react-is "^16.7.0" + hosted-git-info@^3.0.2: version "3.0.8" resolved "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-3.0.8.tgz" @@ -4295,7 +4323,7 @@ lodash.throttle@^4.1.1: resolved "https://registry.npmjs.org/lodash.throttle/-/lodash.throttle-4.1.1.tgz" integrity sha512-wIkUCfVKpVsWo3JSZlc+8MB5it+2AN5W8J7YVMST30UrvcQNZ1Okbj+rbVniijTWE6FGYy4XJq/rHkas8qJMLQ== -lodash@^4.17.13, lodash@^4.17.4: +lodash@^4.17.13, lodash@^4.17.21, lodash@^4.17.4: version "4.17.21" resolved "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== @@ -5479,6 +5507,11 @@ react-is@^16.13.1: resolved "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz" integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ== +react-is@^16.7.0: + version "16.13.1" + resolved "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz" + integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ== + react-native-codegen@^0.70.6: version "0.70.6" resolved "https://registry.npmjs.org/react-native-codegen/-/react-native-codegen-0.70.6.tgz" @@ -5489,6 +5522,17 @@ react-native-codegen@^0.70.6: jscodeshift "^0.13.1" nullthrows "^1.1.1" +"react-native-gesture-handler@>= 1.0.0": + version "2.9.0" + resolved "https://registry.npmjs.org/react-native-gesture-handler/-/react-native-gesture-handler-2.9.0.tgz" + integrity sha512-a0BcH3Qb1tgVqUutc6d3VuWQkI1AM3+fJx8dkxzZs9t06qA27QgURYFoklpabuWpsUTzuKRpxleykp25E8m7tg== + dependencies: + "@egjs/hammerjs" "^2.0.17" + hoist-non-react-statics "^3.3.0" + invariant "^2.2.4" + lodash "^4.17.21" + prop-types "^15.7.2" + react-native-gradle-plugin@^0.70.3: version "0.70.3" resolved "https://registry.npmjs.org/react-native-gradle-plugin/-/react-native-gradle-plugin-0.70.3.tgz" From 446bbbe0a887a117d4d845a3f032f87da76a58fa Mon Sep 17 00:00:00 2001 From: Maxence Lanone Date: Sun, 5 Mar 2023 11:40:18 +0100 Subject: [PATCH 2/3] :fire: rm navbar --- src/components/NavBar.tsx | 34 ---------------------------------- 1 file changed, 34 deletions(-) delete mode 100644 src/components/NavBar.tsx diff --git a/src/components/NavBar.tsx b/src/components/NavBar.tsx deleted file mode 100644 index d39d51c..0000000 --- a/src/components/NavBar.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import * as React from 'react'; -import { TabBarIOSItem, Text, View } from 'react-native'; -import { NavigationContainer } from '@react-navigation/native'; -import { createBottomTabNavigator } from '@react-navigation/bottom-tabs'; - -import DetailMeteo from "../screen/HomePage"; -function HomeScreen() { - return ( - - Home! - - ); -} - -function SettingsScreen() { - return ( - - Settings! - - ); -} - -const Tab = createBottomTabNavigator(); - -export default function App() { - return ( - - - - - - - ); -} \ No newline at end of file From 71a27097245f0e019466a17e353fd4976404be3e Mon Sep 17 00:00:00 2001 From: Maxence Lanone Date: Sun, 5 Mar 2023 12:03:14 +0100 Subject: [PATCH 3/3] :hammer: ajout stack nav --- src/navigator/StackNavigator.tsx | 8 ++++---- src/screen/DetailCity.tsx | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/navigator/StackNavigator.tsx b/src/navigator/StackNavigator.tsx index e8077c4..f7beb2c 100644 --- a/src/navigator/StackNavigator.tsx +++ b/src/navigator/StackNavigator.tsx @@ -9,13 +9,13 @@ const Stack = createStackNavigator(); export default function StackNavigator() { return ( - + - + - + ) } \ No newline at end of file diff --git a/src/screen/DetailCity.tsx b/src/screen/DetailCity.tsx index a9afb70..755d7a1 100644 --- a/src/screen/DetailCity.tsx +++ b/src/screen/DetailCity.tsx @@ -4,12 +4,12 @@ import { FlatList, Button, StyleSheet, Text, View, TextInput, Image } from 'reac import { City, Weather, CITIES_DATA, FAVORITE_CITY_DATA, getCurrentWeather } from '../../data/stub'; import CityListItem from '../components/CityListItem'; -export default function DetailCity() { - +export default function DetailCity({route}) { + const weather = route.params.weather; return ( - Test + {weather.temperature} );