parent
db2c45d692
commit
76577e9a66
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 194 KiB |
@ -1,58 +1,58 @@
|
|||||||
import React from "react";
|
import React, { useState, useSyncExternalStore } from "react";
|
||||||
import { View, StyleSheet, Text, Button, TouchableHighlight, Image } from "react-native";
|
import { View, StyleSheet, Text, Button, TouchableHighlight, Image } from "react-native";
|
||||||
import { City } from "../data/stub";
|
import { City, getCurrentWeather, Weather } from "../data/stub";
|
||||||
|
|
||||||
|
|
||||||
type VilleProps = {
|
type VilleProps = {
|
||||||
city: City
|
city: City,
|
||||||
|
fav: City
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export function VilleCompopo(props: VilleProps){
|
export function VilleCompopo(props: VilleProps){
|
||||||
|
const weather = getCurrentWeather(props.city.name);
|
||||||
return (
|
return (
|
||||||
<View>
|
|
||||||
<View style={styles.container}>
|
<View style={styles.container}>
|
||||||
<View style={styles.bothtext}>
|
<View style={{flex: 1, flexDirection: "row"}}>
|
||||||
<Text style={styles.title}>{props.city.name}</Text>
|
<View style={styles.bothtext}>
|
||||||
<Text>{props.city.latitude} - {props.city.longitude}</Text>
|
<Text style={styles.title}>{props.city.name}</Text>
|
||||||
</View>
|
<Text>{props.city.latitude} - {props.city.longitude}</Text>
|
||||||
<TouchableHighlight>
|
</View>
|
||||||
<Image source={{uri: "http://simpleicon.com/wp-content/uploads/star.svg"}}/>
|
<Text style={styles.temperature}>{weather?.temperature}</Text>
|
||||||
|
<TouchableHighlight /*onPress={() => props.fav = this.city}*/>
|
||||||
|
<Image source={ props.city==props.fav ? require('../assets/yellowstar.png') : require('../assets/blackstar.png')} style={styles.button}/>
|
||||||
</TouchableHighlight>
|
</TouchableHighlight>
|
||||||
|
</View>
|
||||||
</View>
|
</View>
|
||||||
<View style={styles.separator}/>
|
|
||||||
</View>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
container: {
|
container: {
|
||||||
flex: 1,
|
flex: 1,
|
||||||
flexDirection: "row",
|
|
||||||
marginHorizontal: "5%",
|
|
||||||
backgroundColor: "darksalmon",
|
backgroundColor: "darksalmon",
|
||||||
margin: 5,
|
marginVertical: 5,
|
||||||
borderRadius: 15,
|
borderRadius: 15,
|
||||||
width: "90%"
|
width: "90%",
|
||||||
},
|
alignSelf: 'center'
|
||||||
separator: {
|
|
||||||
marginVertical: 4,
|
|
||||||
backgroundColor: "rgba(255,255,255,0.3)",
|
|
||||||
height: 1,
|
|
||||||
width: '90%',
|
|
||||||
},
|
|
||||||
teaserImage: {
|
|
||||||
width: 50,
|
|
||||||
height: 50,
|
|
||||||
},
|
},
|
||||||
title: {
|
title: {
|
||||||
fontWeight: "bold",
|
fontWeight: "bold",
|
||||||
fontSize: 18
|
fontSize: 18
|
||||||
},
|
},
|
||||||
bothtext: {
|
bothtext: {
|
||||||
width: "80%",
|
|
||||||
margin: 10
|
margin: 10
|
||||||
},
|
},
|
||||||
|
temperature: {
|
||||||
|
marginTop: 20,
|
||||||
|
fontSize: 18,
|
||||||
|
fontWeight: "bold"
|
||||||
|
},
|
||||||
button: {
|
button: {
|
||||||
color: "black"
|
height: 30,
|
||||||
|
width: 30,
|
||||||
|
marginTop: 13,
|
||||||
|
alignSelf: "flex-end",
|
||||||
|
margin: 5
|
||||||
}
|
}
|
||||||
});
|
});
|
Loading…
Reference in new issue