2021-08-16 07:50:50 +00:00
|
|
|
import * as React from 'react';
|
2021-08-17 21:05:34 +00:00
|
|
|
import { Alert, Button, StyleSheet, Switch, TextInput } from 'react-native';
|
2021-08-16 07:50:50 +00:00
|
|
|
import { Text, View } from '../components/Themed';
|
2021-08-16 22:39:34 +00:00
|
|
|
import { useState } from 'react';
|
2021-08-17 21:05:34 +00:00
|
|
|
import ScreenInfo from '../components/ScreenInfo';
|
2021-08-17 15:38:51 +00:00
|
|
|
import { SafeAreaView } from 'react-native-safe-area-context';
|
2021-08-16 07:50:50 +00:00
|
|
|
|
|
|
|
export default function SettingsScreen() {
|
2021-08-17 21:05:34 +00:00
|
|
|
const [number, onChangeNumber] = React.useState("");
|
|
|
|
const [isKM, setMiles] = useState(false);
|
|
|
|
const toggleUnits = () => setMiles(previousState => !previousState);
|
2021-08-16 22:39:34 +00:00
|
|
|
|
2021-08-16 07:50:50 +00:00
|
|
|
return (
|
|
|
|
<View style={styles.container}>
|
|
|
|
<Text style={styles.title}>Model Settings</Text>
|
|
|
|
<View style={styles.separator} lightColor="#eee" darkColor="rgba(255,255,255,0.1)" />
|
2021-08-17 21:05:34 +00:00
|
|
|
<ScreenInfo />
|
2021-08-17 15:38:51 +00:00
|
|
|
<Switch
|
2021-08-17 21:05:34 +00:00
|
|
|
style={styles.switch}
|
2021-08-16 22:39:34 +00:00
|
|
|
trackColor={{ false: "#767577", true: "#81b0ff" }}
|
|
|
|
thumbColor={true ? "#f5dd4b" : "#f4f3f4"}
|
|
|
|
ios_backgroundColor="#3e3e3e"
|
|
|
|
onValueChange={toggleUnits}
|
|
|
|
value={isKM}
|
2021-08-17 15:38:51 +00:00
|
|
|
/>
|
2021-08-17 21:05:34 +00:00
|
|
|
<View style={styles.controls} >
|
|
|
|
<Button
|
|
|
|
title="Jet"
|
2021-08-17 22:00:09 +00:00
|
|
|
onPress={() => Alert.alert('Jet Fuel Selected \n 285 g / passenger / km')}
|
2021-08-17 21:05:34 +00:00
|
|
|
/>
|
|
|
|
<Button
|
|
|
|
title="Gasoline"
|
2021-08-17 22:00:09 +00:00
|
|
|
onPress={() => Alert.alert('Gasoline Selected \n 255 g for driver \n only passenger / km')}
|
2021-08-17 21:05:34 +00:00
|
|
|
/>
|
|
|
|
<Button
|
|
|
|
title="Food"
|
|
|
|
onPress={() => Alert.alert('Savings vs Gasoline Selected')}
|
|
|
|
/>
|
|
|
|
</View>
|
|
|
|
<TextInput
|
2021-08-16 22:39:34 +00:00
|
|
|
style={styles.input}
|
2021-08-17 21:05:34 +00:00
|
|
|
returnKeyType={'done'}
|
2021-08-16 22:39:34 +00:00
|
|
|
onChangeText={onChangeNumber}
|
|
|
|
value={number}
|
2021-08-22 04:30:04 +00:00
|
|
|
placeholder="250"
|
2021-08-16 22:39:34 +00:00
|
|
|
keyboardType="numeric"
|
2021-08-17 21:05:34 +00:00
|
|
|
/>
|
2021-08-16 07:50:50 +00:00
|
|
|
</View>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2021-08-17 21:05:34 +00:00
|
|
|
|
2021-08-16 07:50:50 +00:00
|
|
|
const styles = StyleSheet.create({
|
2021-08-17 21:05:34 +00:00
|
|
|
switch: {
|
|
|
|
marginVertical: 20,
|
|
|
|
},
|
2021-08-16 07:50:50 +00:00
|
|
|
container: {
|
|
|
|
flex: 1,
|
|
|
|
alignItems: 'center',
|
|
|
|
justifyContent: 'center',
|
|
|
|
},
|
2021-08-17 21:05:34 +00:00
|
|
|
controls: {
|
|
|
|
marginVertical: 20,
|
|
|
|
width: "80%",
|
|
|
|
flexDirection: 'row',
|
|
|
|
justifyContent: "space-between",
|
|
|
|
},
|
2021-08-16 07:50:50 +00:00
|
|
|
title: {
|
|
|
|
fontSize: 20,
|
|
|
|
fontWeight: 'bold',
|
|
|
|
},
|
|
|
|
separator: {
|
2021-08-17 21:05:34 +00:00
|
|
|
marginVertical: 10,
|
2021-08-16 07:50:50 +00:00
|
|
|
height: 1,
|
|
|
|
width: '80%',
|
|
|
|
},
|
2021-08-16 22:39:34 +00:00
|
|
|
input: {
|
|
|
|
height: 40,
|
2021-08-17 21:05:34 +00:00
|
|
|
margin: 30,
|
2021-08-16 22:39:34 +00:00
|
|
|
borderWidth: 1,
|
|
|
|
padding: 10,
|
|
|
|
},
|
2021-08-16 07:50:50 +00:00
|
|
|
});
|