From 44d5b4f7724d7f7a737b18833ca72946fca69910 Mon Sep 17 00:00:00 2001 From: Paul SQUIZZATO Date: Fri, 10 Feb 2023 09:54:12 +0100 Subject: [PATCH] =?UTF-8?q?franchement,=20=C3=A7a=20va?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.tsx | 3 +- package.json | 6 +--- src/components/NavBar.tsx | 3 +- src/navigator/Navigator.tsx | 5 ++-- src/screen/DetailMeteo.tsx | 49 +++++++++++++++++++++++++++++++ yarn.lock | 58 ++++++++++++++++++++++++++++++++----- 6 files changed, 107 insertions(+), 17 deletions(-) create mode 100644 src/screen/DetailMeteo.tsx diff --git a/App.tsx b/App.tsx index 108ed68..5aa010c 100644 --- a/App.tsx +++ b/App.tsx @@ -2,8 +2,9 @@ import { StatusBar } from 'expo-status-bar'; import { 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 MainTab from './src/navigator/Navigator.tsx'; +import MainTab from './src/navigator/Navigator'; export default function App() { return ( diff --git a/package.json b/package.json index 208b037..7b6d3e2 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,6 @@ "web": "expo start --web" }, "dependencies": { - "@mindinventory/react-native-tab-bar-interaction": "^2.2.3", "@react-navigation/bottom-tabs": "^6.5.4", "@react-navigation/native": "^6.1.3", "expo": "~47.0.12", @@ -17,10 +16,7 @@ "react": "18.1.0", "react-dom": "18.1.0", "react-native": "0.70.5", - "react-native-maps": "^1.4.0", - "react-native-safe-area-context": "^4.5.0", - "react-native-web": "~0.18.9", - "react-navigation-tabbar-collection": "^1.0.0" + "react-native-web": "~0.18.9" }, "devDependencies": { "@babel/core": "^7.12.9", diff --git a/src/components/NavBar.tsx b/src/components/NavBar.tsx index c0e49ad..a74c8ce 100644 --- a/src/components/NavBar.tsx +++ b/src/components/NavBar.tsx @@ -3,6 +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"; function HomeScreen() { return ( @@ -25,7 +26,7 @@ export default function App() { return ( - + diff --git a/src/navigator/Navigator.tsx b/src/navigator/Navigator.tsx index d40eb10..282f07b 100644 --- a/src/navigator/Navigator.tsx +++ b/src/navigator/Navigator.tsx @@ -3,10 +3,9 @@ import { createBottomTabNavigator } from "@react-navigation/bottom-tabs"; 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 AddCity from "../screen/AddCity"; - const Tab = createBottomTabNavigator(); export default function MainTab(){ @@ -15,7 +14,7 @@ export default function MainTab(){ - diff --git a/src/screen/DetailMeteo.tsx b/src/screen/DetailMeteo.tsx new file mode 100644 index 0000000..7db2e49 --- /dev/null +++ b/src/screen/DetailMeteo.tsx @@ -0,0 +1,49 @@ +import { useState } from 'react'; +import { Button, StyleSheet, Text, View } from 'react-native'; +import { City, Weather, CITIES_DATA, FAVORITE_CITY_DATA, getCurrentWeather } from '../../data/stub'; + +export default function DetailMeteo() { +/* + const [meteo, setMeteo] = useState("Meteo"); + const [city, setCity] = useState(new City("Paris", 48.856614, 2.3522219)); +*/ + const [weather, setWeather] = useState(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))) + return ( + + {weather.temperature} + {weather.humidity} + {weather.windspeed} + + ); +} + +const styles = StyleSheet.create({ + container: { + flex: 1, + backgroundColor: '#fff', + alignItems: 'center', + justifyContent: 'center', + }, +}); + +/* +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 cafbf96..0644862 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": + "integrity" "sha512-XQsZgjm2EcVUiZQf11UBJQfmZeEmOW8DpI1gsFeln6w0ae0ii4dMQEQ0kjl6DspdWX1aGY1/loyXnP0JS06e/A==" + "resolved" "https://registry.npmjs.org/@egjs/hammerjs/-/hammerjs-2.0.17.tgz" + "version" "2.0.17" + dependencies: + "@types/hammerjs" "^2.0.36" + "@expo/bunyan@^4.0.0", "@expo/bunyan@4.0.0": "integrity" "sha512-Ydf4LidRB/EBI+YrB+cVLqIseiRfjUI/AeHBgjGMtq3GroraDu81OV7zqophRgupngoL3iS3JUMDMnxO7g39qA==" "resolved" "https://registry.npmjs.org/@expo/bunyan/-/bunyan-4.0.0.tgz" @@ -1807,6 +1814,11 @@ "resolved" "https://registry.npmjs.org/@types/geojson/-/geojson-7946.0.10.tgz" "version" "7946.0.10" +"@types/hammerjs@^2.0.36": + "integrity" "sha512-ewXv/ceBaJprikMcxCmWU1FKyMAQ2X7a9Gtmzw8fcg2kIePI1crERDM818W+XYrxqdBBOdlf2rm137bU+BltCA==" + "resolved" "https://registry.npmjs.org/@types/hammerjs/-/hammerjs-2.0.41.tgz" + "version" "2.0.41" + "@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0": "integrity" "sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g==" "resolved" "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz" @@ -3539,11 +3551,6 @@ "resolved" "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz" "version" "1.0.0" -"fsevents@^2.1.2": - "integrity" "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==" - "resolved" "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz" - "version" "2.3.2" - "function-bind@^1.1.1": "integrity" "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" "resolved" "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz" @@ -3726,6 +3733,13 @@ dependencies: "source-map" "^0.7.3" +"hoist-non-react-statics@^3.3.0": + "integrity" "sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==" + "resolved" "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz" + "version" "3.3.2" + dependencies: + "react-is" "^16.7.0" + "hosted-git-info@^3.0.2": "integrity" "sha512-aXpmwoOhRBrw6X3j0h5RloK4x1OzsxMPyxqIHyNfSe2pypkVTZFpEiRoSipPEPlMrh0HW/XsjkJ5WgnCirpNUw==" "resolved" "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-3.0.8.tgz" @@ -4370,7 +4384,7 @@ "resolved" "https://registry.npmjs.org/lodash.throttle/-/lodash.throttle-4.1.1.tgz" "version" "4.1.1" -"lodash@^4.17.13", "lodash@^4.17.4": +"lodash@^4.17.13", "lodash@^4.17.21", "lodash@^4.17.4": "integrity" "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" "resolved" "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz" "version" "4.17.21" @@ -4399,7 +4413,7 @@ "dayjs" "^1.8.15" "yargs" "^15.1.0" -"loose-envify@^1.0.0", "loose-envify@^1.1.0", "loose-envify@^1.3.1": +"loose-envify@^1.0.0", "loose-envify@^1.1.0", "loose-envify@^1.3.1", "loose-envify@^1.4.0": "integrity" "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==" "resolved" "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz" "version" "1.4.0" @@ -5456,6 +5470,15 @@ "kleur" "^3.0.3" "sisteransi" "^1.0.5" +"prop-types@^15.7.2": + "integrity" "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==" + "resolved" "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz" + "version" "15.8.1" + dependencies: + "loose-envify" "^1.4.0" + "object-assign" "^4.1.1" + "react-is" "^16.13.1" + "pump@^3.0.0": "integrity" "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==" "resolved" "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz" @@ -5552,6 +5575,16 @@ "resolved" "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz" "version" "16.13.1" +"react-is@^16.13.1": + "integrity" "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==" + "resolved" "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz" + "version" "16.13.1" + +"react-is@^16.7.0": + "integrity" "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==" + "resolved" "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz" + "version" "16.13.1" + "react-native-codegen@^0.70.6": "integrity" "sha512-kdwIhH2hi+cFnG5Nb8Ji2JwmcCxnaOOo9440ov7XDzSvGfmUStnCzl+MCW8jLjqHcE4icT7N9y+xx4f50vfBTw==" "resolved" "https://registry.npmjs.org/react-native-codegen/-/react-native-codegen-0.70.6.tgz" @@ -5562,6 +5595,17 @@ "jscodeshift" "^0.13.1" "nullthrows" "^1.1.1" +"react-native-gesture-handler@^2.9.0": + "integrity" "sha512-a0BcH3Qb1tgVqUutc6d3VuWQkI1AM3+fJx8dkxzZs9t06qA27QgURYFoklpabuWpsUTzuKRpxleykp25E8m7tg==" + "resolved" "https://registry.npmjs.org/react-native-gesture-handler/-/react-native-gesture-handler-2.9.0.tgz" + "version" "2.9.0" + 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": "integrity" "sha512-oOanj84fJEXUg9FoEAQomA8ISG+DVIrTZ3qF7m69VQUJyOGYyDZmPqKcjvRku4KXlEH6hWO9i4ACLzNBh8gC0A==" "resolved" "https://registry.npmjs.org/react-native-gradle-plugin/-/react-native-gradle-plugin-0.70.3.tgz"