diff --git a/Ejectable/GT2Service.js b/Ejectable/GT2Service.js
index 4e207e2a..8d8dd547 100644
--- a/Ejectable/GT2Service.js
+++ b/Ejectable/GT2Service.js
@@ -2,10 +2,16 @@ import React, { useState, useEffect } from 'react';
import { Platform, Text, View, StyleSheet } from 'react-native';
import * as Location from 'expo-location';
-export default function GT2Service() {
+export class GT2Service {
+
+ constructor () {
const [location, setLocation] = useState(null);
const [errorMsg, setErrorMsg] = useState(null);
+ }
+
+ start() {
+
useEffect(() => {
(async () => {
let { status } = await Location.requestForegroundPermissionsAsync();
@@ -17,19 +23,20 @@ export default function GT2Service() {
let location = await Location.getCurrentPositionAsync({});
setLocation(location);
})();
- }, []);
+ }, []);
- let text = 'Waiting..';
- if (errorMsg) {
+ let text = 'Waiting..';
+ if (errorMsg) {
text = errorMsg;
- } else if (location) {
+ } else if (location) {
text = JSON.stringify(location);
- }
+ }
- return (
+ return (
{text}
- );
-}
+ );
+ }
+}
diff --git a/Ejectable/components/ScreenInfo.tsx b/Ejectable/components/ScreenInfo.tsx
index 68bf53cc..4f7b22c4 100644
--- a/Ejectable/components/ScreenInfo.tsx
+++ b/Ejectable/components/ScreenInfo.tsx
@@ -13,7 +13,7 @@ export default function ScreenInfo() {
style={styles.settingsText}
lightColor="rgba(0,0,0,0.8)"
darkColor="rgba(255,255,255,0.8)">
- Toggle km/mi, select fuel used, or manually set CO2 per distance
+ Switch dark km/ light mi, select fuel used, or manually set CO2 per distance
);
diff --git a/Ejectable/package.json b/Ejectable/package.json
index 3959a7c0..7e7e85f3 100644
--- a/Ejectable/package.json
+++ b/Ejectable/package.json
@@ -22,6 +22,7 @@
"expo-constants": "~11.0.1",
"expo-font": "~9.2.1",
"expo-linking": "~2.3.1",
+ "expo-location": "~12.1.2",
"expo-splash-screen": "~0.11.2",
"expo-status-bar": "~1.0.4",
"expo-web-browser": "~9.2.0",
@@ -32,8 +33,7 @@
"react-native-reanimated": "~2.2.0",
"react-native-safe-area-context": "3.2.0",
"react-native-screens": "~3.4.0",
- "react-native-web": "~0.13.12",
- "expo-location": "~12.1.2"
+ "react-native-web": "~0.13.12"
},
"devDependencies": {
"@babel/core": "^7.9.0",
diff --git a/Ejectable/screens/SettingsScreen.tsx b/Ejectable/screens/SettingsScreen.tsx
index a19f63da..c6059ed5 100644
--- a/Ejectable/screens/SettingsScreen.tsx
+++ b/Ejectable/screens/SettingsScreen.tsx
@@ -1,59 +1,82 @@
import * as React from 'react';
-import { StyleSheet, Switch, TextInput } from 'react-native';
+import { Alert, Button, StyleSheet, Switch, TextInput } from 'react-native';
import { Text, View } from '../components/Themed';
import { useState } from 'react';
-import SettingsScreenInfo from '../components/SettingsScreenInfo';
+import ScreenInfo from '../components/ScreenInfo';
import { SafeAreaView } from 'react-native-safe-area-context';
export default function SettingsScreen() {
- const [text, onChangeText] = React.useState("Useless Text");
- const [number, onChangeNumber] = React.useState(null);
- const [isKM, setIsKM] = useState(false);
- const toggleUnits = () => setIsKM(previousState => !previousState);
+ const [number, onChangeNumber] = React.useState("");
+ const [isKM, setMiles] = useState(false);
+ const toggleUnits = () => setMiles(previousState => !previousState);
return (
Model Settings
-
+
-
+
+
+ />
);
}
+
const styles = StyleSheet.create({
+ switch: {
+ marginVertical: 20,
+ },
container: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
},
+ controls: {
+ marginVertical: 20,
+ width: "80%",
+ flexDirection: 'row',
+ justifyContent: "space-between",
+ },
title: {
fontSize: 20,
fontWeight: 'bold',
},
separator: {
- marginVertical: 30,
+ marginVertical: 10,
height: 1,
width: '80%',
},
input: {
height: 40,
- margin: 12,
+ margin: 30,
borderWidth: 1,
padding: 10,
},
diff --git a/Ejectable/screens/TripScreen.tsx b/Ejectable/screens/TripScreen.tsx
index e456630b..91147b71 100644
--- a/Ejectable/screens/TripScreen.tsx
+++ b/Ejectable/screens/TripScreen.tsx
@@ -1,13 +1,15 @@
import * as React from 'react';
import { Button, StyleSheet, Alert } from 'react-native';
import { Text, View } from '../components/Themed';
+import { GT2Service } from '../GT2Service.js';
+import { ScreenInfo2 } from '../components/ScreenInfo';
export default function TripScreen() {
return (
Trip Control
-
-
+
+