You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
1.1 KiB
34 lines
1.1 KiB
import { View, Text, StyleSheet, TouchableHighlight } from "react-native"
|
|
import { FlatList } from "react-native-gesture-handler"
|
|
import { CITIES_DATA, City, getCurrentWeather, FAVORITE_CITY_DATA } from "../data/stub"
|
|
import { VilleCompopo } from "../components/VilleCompopo";
|
|
import { TopBar } from "../components/TopBar";
|
|
import { useSelector } from "react-redux";
|
|
|
|
|
|
export default function CityList({navigation}){
|
|
|
|
const cityList = useSelector(state => state.appReducer.city);
|
|
|
|
|
|
return (
|
|
<View style={{flex: 1, width: "100%", alignItems: "center"}}>
|
|
<TopBar/>
|
|
<FlatList
|
|
data={cityList}
|
|
keyExtractor={item =>item.name}
|
|
renderItem={({item}) => <TouchableHighlight onPress={() => navigation.navigate("CityDetails", {"city": item})}><VilleCompopo city={item} fav={FAVORITE_CITY_DATA}/></TouchableHighlight>}
|
|
style={leStyle.container}
|
|
/>
|
|
</View>
|
|
)
|
|
}
|
|
|
|
|
|
const leStyle = StyleSheet.create({
|
|
container: {
|
|
flex: 1,
|
|
alignContent: 'center',
|
|
width: '100%'
|
|
},
|
|
}); |