import React from 'react'; import { View, Text, Image, Button } from 'react-native'; import AsyncStorage from '@react-native-async-storage/async-storage'; import { TouchableHighlight } from 'react-native-gesture-handler'; import { useNavigation } from '@react-navigation/native'; import { insertFavorite } from '../thunk/favorites/thunkStoreFavorite'; import { useDispatch } from 'react-redux'; import Icon from 'react-native-vector-icons/MaterialCommunityIcons'; import { getImageSource, getTemperatureColor } from '../Components/ImageWeatherType'; const Details = ({ route }) => { const weather = route.params.weather; const dispatch = useDispatch(); const handleAddFavorite = () => { dispatch(insertFavorite(weather)); }; const navigation = useNavigation(); const temperatureColor = getTemperatureColor(weather._temperature); return ( {weather.at} {weather.temperature}°C {weather.weatherDescription} {weather.humidity}% {weather.windSpeed} km/h {weather.pressure} hPa {weather.city.name} Latitude: {weather.city.latitude} Longitude: {weather.city.longitude} navigation.navigate("Favorite", { "weather": weather })}> Favoris ); }; const styles = { container: { flex: 1, alignItems: 'center', justifyContent: 'center', }, buttonAddFavorite: { backgroundColor: '#ead9a', padding: 10, borderRadius: 5, marginBottom: 10, }, title: { fontSize: 20, fontWeight: 'bold', textAlign: 'center', }, weatherContainer: { alignItems: 'center', marginBottom: 20, }, weatherIcon: { width: 100, height: 100, borderRadius: 50, marginBottom: 10, }, temperatureText: { fontSize: 40, fontWeight: 'bold', }, weatherDescriptionText: { fontSize: 20, marginBottom: 10, }, detailsContainer: { flexDirection: 'row', justifyContent: 'space-around', marginBottom: 20, }, detail: { alignItems: 'center', padding: 12, }, detailIcon: { color: 'gray', marginBottom: 5, }, detailText: { fontSize: 14, }, cityContainer: { alignItems: 'center', }, cityText: { fontSize: 18, fontWeight: 'bold', marginBottom: 10, }, buttonFavorite: { backgroundColor: '#a5d9', padding: 10, borderRadius: 5, margin: 50 }, buttonText: { color: 'white', fontSize: 18, fontWeight: 'bold', }, }; export default Details;