2021-08-16 07:50:50 +00:00
|
|
|
import * as React from 'react';
|
2021-08-16 22:39:34 +00:00
|
|
|
import { 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';
|
|
|
|
import SettingsScreenInfo from '../components/SettingsScreenInfo';
|
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-16 22:39:34 +00:00
|
|
|
const [text, onChangeText] = React.useState("Useless Text");
|
|
|
|
const [number, onChangeNumber] = React.useState(null);
|
|
|
|
const [isKM, setIsKM] = useState(false);
|
|
|
|
const toggleUnits = () => setIsKM(previousState => !previousState);
|
|
|
|
|
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 15:38:51 +00:00
|
|
|
<SettingsScreenInfo />
|
|
|
|
<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
|
|
|
/>
|
|
|
|
<TextInput
|
2021-08-16 22:39:34 +00:00
|
|
|
style={styles.input}
|
|
|
|
onChangeText={onChangeNumber}
|
|
|
|
value={number}
|
2021-08-17 15:38:51 +00:00
|
|
|
defaultValue="0.66666"
|
|
|
|
returnKeyType={'done'}
|
2021-08-16 22:39:34 +00:00
|
|
|
placeholder="CO2 Per km/mi"
|
|
|
|
keyboardType="numeric"
|
2021-08-17 15:38:51 +00:00
|
|
|
/>
|
2021-08-16 07:50:50 +00:00
|
|
|
</View>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
const styles = StyleSheet.create({
|
|
|
|
container: {
|
|
|
|
flex: 1,
|
|
|
|
alignItems: 'center',
|
|
|
|
justifyContent: 'center',
|
|
|
|
},
|
|
|
|
title: {
|
|
|
|
fontSize: 20,
|
|
|
|
fontWeight: 'bold',
|
|
|
|
},
|
|
|
|
separator: {
|
|
|
|
marginVertical: 30,
|
|
|
|
height: 1,
|
|
|
|
width: '80%',
|
|
|
|
},
|
2021-08-16 22:39:34 +00:00
|
|
|
input: {
|
|
|
|
height: 40,
|
|
|
|
margin: 12,
|
|
|
|
borderWidth: 1,
|
|
|
|
padding: 10,
|
|
|
|
},
|
2021-08-16 07:50:50 +00:00
|
|
|
});
|