parent
8d2460f10e
commit
3b4213c78c
@ -0,0 +1,54 @@
|
||||
//item for meteo in list
|
||||
|
||||
import React from 'react';
|
||||
import { StyleSheet, Text, View, Image, TouchableOpacity, Switch } from 'react-native';
|
||||
import { City, Weather, CITIES_DATA, FAVORITE_CITY_DATA, getCurrentWeather } from '../../data/stub';
|
||||
import { useNavigation } from '@react-navigation/native';
|
||||
import { useState } from 'react';
|
||||
|
||||
type OptionComponentProps = {
|
||||
nameOption: String;
|
||||
}
|
||||
|
||||
export default function OptionComponent(props: OptionComponentProps) {
|
||||
const [isEnabled, setIsEnabled] = useState(false);
|
||||
const toggleSwitch = () => setIsEnabled(previousState => !previousState);
|
||||
return (
|
||||
<>
|
||||
<View style={styles.container}>
|
||||
<Text style={styles.text}>{props.nameOption}</Text>
|
||||
<Switch trackColor={{ false: '#767577' }}
|
||||
onValueChange={toggleSwitch}
|
||||
value={isEnabled}></Switch>
|
||||
</View>
|
||||
</>
|
||||
|
||||
)
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
container: {
|
||||
flex: 0,
|
||||
flexDirection: 'row',
|
||||
justifyContent: 'space-evenly',
|
||||
alignItems: 'center',
|
||||
width: '80%',
|
||||
},
|
||||
separator: {
|
||||
marginVertical: 4,
|
||||
backgroundColor: "rgba(223,223,223,1)",
|
||||
height: 1,
|
||||
width: '90%',
|
||||
},
|
||||
teaserImage: {
|
||||
width: 50,
|
||||
height: 50,
|
||||
},
|
||||
text: {
|
||||
fontWeight: "bold",
|
||||
color: "black",
|
||||
margin: 10,
|
||||
width: '100%',
|
||||
},
|
||||
});
|
||||
|
@ -0,0 +1,29 @@
|
||||
import { useState } from 'react';
|
||||
import { Button, StyleSheet, Text, View, SafeAreaView, FlatList, ListViewBase } from 'react-native';
|
||||
import { City, Weather, CITIES_DATA, FAVORITE_CITY_DATA, getCurrentWeather } from '../../data/stub';
|
||||
import CityListItem from '../components/CityListItem';
|
||||
import OptionComponent from '../components/OptionComponent';
|
||||
|
||||
export default function Settings() {
|
||||
|
||||
const [meteo, setMeteo] = useState("Meteo");
|
||||
const [city, setCity] = useState<City>(new City("Paris", 48.856614, 2.3522219));
|
||||
|
||||
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
<SafeAreaView/>
|
||||
<OptionComponent nameOption="Dark Theme"></OptionComponent>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
container: {
|
||||
flex: 1,
|
||||
backgroundColor: '#fff',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'flex-start',
|
||||
paddingTop: 20,
|
||||
},
|
||||
});
|
Loading…
Reference in new issue