import React, { useState } from 'react'; import { View, Text, Image, StyleSheet, Dimensions, ImageBackground, TouchableOpacity, Modal } from 'react-native'; import Icon from 'react-native-vector-icons/MaterialCommunityIcons'; import { City, Weather } from '../data/stub'; import { getImageSource } from './ImageWeatherType'; type MeteoProps = { city : City, weather : Weather } export function WeatherCard(props: MeteoProps) { const [showPopup, setShowPopup] = useState(false); const togglePopup = () => { setShowPopup(!showPopup); }; return ( {props.city.name} {props.weather.weatherType} {props.weather.temperature} °C {props.weather.visibility} {props.weather.windSpeed} {props.weather.pressure} {props.weather.humidity} {props.weather.temperatureFeelsLike} Popup content ); }; const styles = StyleSheet.create({ container: { backgroundColor: 'rgba(255, 255, 255, 0.5)', borderRadius: 8, borderWidth: 2, borderColor:'rgba(200, 200, 200, 0.5)', marginBottom: 16, alignSelf: 'center', width: '75%', // 3/4 de la largeur de l'écran }, titleContainer: { padding: 8, }, title: { fontSize: 16, fontWeight: 'bold', textAlign: 'center', }, contentContainer: { flexDirection: 'row', alignItems: 'center', padding: 16, }, imageContainer: { marginRight: 16, }, image: { width: 80, height: 80, borderRadius: 15, }, iconContainer: { flex: 1, flexDirection: 'column', }, row: { flexDirection: 'row', justifyContent: 'space-between', marginBottom: 8, }, iconWithText: { alignItems: 'center', }, icon: { fontSize: 20, color: '#333333', borderWidth: 1, borderColor: '#333333', borderRadius: 8, padding: 8, marginBottom: 8, }, iconText: { marginTop: 4, fontSize: 12, textAlign: 'center', }, popupContainer: { flex: 1, backgroundColor: 'rgba(0, 0, 0, 0.5)', justifyContent: 'center', alignItems: 'center', }, popupText: { fontSize: 24, color: '#FFFFFF', marginBottom: 16, }, closeButton: { position: 'absolute', top: 16, right: 16, backgroundColor: '#FFFFFF', borderRadius: 20, padding: 8, }, closeIcon: { fontSize: 20, color: '#333333', }, });