diff --git a/App.tsx b/App.tsx index 5aa010c..96a44fa 100644 --- a/App.tsx +++ b/App.tsx @@ -1,5 +1,5 @@ import { StatusBar } from 'expo-status-bar'; -import { StyleSheet, Text, View } from 'react-native'; +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'; @@ -8,7 +8,14 @@ import MainTab from './src/navigator/Navigator'; export default function App() { return ( - + <> + + + + + + + ); } @@ -19,4 +26,12 @@ const styles = StyleSheet.create({ alignItems: 'center', justifyContent: 'center', }, + mainSafeArea: { + flex: 1, + backgroundColor: "transparent" + }, + topSafeArea: { + flex: 0, + backgroundColor: 'transparent' + } }); diff --git a/src/components/WidgetMeteo.tsx b/src/components/WidgetMeteo.tsx new file mode 100644 index 0000000..415d16e --- /dev/null +++ b/src/components/WidgetMeteo.tsx @@ -0,0 +1,42 @@ +import React from 'react'; +import { StyleSheet, Text, View, Image, TouchableOpacity } from 'react-native'; +import { City, Weather, CITIES_DATA, FAVORITE_CITY_DATA, getCurrentWeather } from '../../data/stub'; +import { useNavigation } from '@react-navigation/native'; + +type WidgetMeteoProps = { + item: Weather; +} + +export default function WidgetMeteo(props : WidgetMeteoProps) { +return ( + + {props.item.city.name} + {props.item.temperature} °C + + +) +} + +const styles = StyleSheet.create({ + container: { + flex: 0, + justifyContent: 'center', + alignItems: 'center', + backgroundColor: '#F5FCFF', + margin: 10, + padding: 10, + borderRadius: 10, + shadowColor: "#000", + width: 150, + height: 150, + shadowOffset: { + width: 0, + height: 2, + }, + shadowOpacity: 0.25, + shadowRadius: 3.84, + elevation: 5, + }, +}); + + \ No newline at end of file diff --git a/src/navigator/Navigator.tsx b/src/navigator/Navigator.tsx index 282f07b..29cb5dd 100644 --- a/src/navigator/Navigator.tsx +++ b/src/navigator/Navigator.tsx @@ -12,7 +12,7 @@ export default function MainTab(){ return ( (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))) + + //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 ( - - {weather.temperature} - {weather.humidity} - {weather.windspeed} - - ); + + + + + + + ) } const styles = StyleSheet.create({ container: { flex: 1, - backgroundColor: '#fff', - alignItems: 'center', - justifyContent: 'center', }, -}); + flatList: { + flex: 1, + flexDirection: "column", + flexWrap: "wrap", + }, + } +); /* new Weather("2023-01-22 09:55:59", 10000, "Nuageux", diff --git a/src/screen/Meteo.tsx b/src/screen/Meteo.tsx index 6f7f4dd..b4f7323 100644 --- a/src/screen/Meteo.tsx +++ b/src/screen/Meteo.tsx @@ -1,5 +1,5 @@ import { useState } from 'react'; -import { Button, StyleSheet, Text, View } from 'react-native'; +import { Button, StyleSheet, Text, View, SafeAreaView } from 'react-native'; import { City, Weather, CITIES_DATA, FAVORITE_CITY_DATA, getCurrentWeather } from '../../data/stub'; export default function Meteo() { @@ -10,6 +10,7 @@ export default function Meteo() { return ( + {city.name} {city.latitude} {city.longitude}