This commit is contained in:
Ren Juan 2021-08-20 11:23:16 +00:00
parent 16b5d0d30d
commit afbcd3fba7
1 changed files with 5 additions and 40 deletions

View File

@ -2,18 +2,9 @@ import * as React from 'react';
import { Button, StyleSheet, Alert } from 'react-native';
import { Text, View } from '../components/Themed';
import { ScreenInfo2 } from '../components/ScreenInfo';
import { thisTrip } from '../GT2';
import { TripStack } from '../navigation/BottomTabNavigator';
import { GT2, thisTrip } from '../GT2';
const styles = StyleSheet.create({
tripText: {
marginHorizontal: -100,
marginVertical: 60,
textAlign: 'left',
width: "80%",
fontSize: 12,
fontWeight: 'bold',
},
container: {
flex: 1,
alignItems: 'center',
@ -44,6 +35,8 @@ function startTrip() {
}
function pauseTrip() {
thisTrip.pause();
Alert.alert('Trip Paused');
}
@ -57,7 +50,6 @@ function endTrip() {
export default function TripScreen() {
if (!thisTrip.inProgress)
return (
<View style={styles.container}>
<Text style={styles.title}>Trip Control</Text>
@ -77,34 +69,7 @@ export default function TripScreen() {
onPress={() => endTrip() }
/>
</View>
</View>
); else
return (
<View style={styles.container}>
<Text style={styles.title}>Trip Control</Text>
<View style={styles.separator} lightColor="#eee" darkColor="rgba(255,255,255,0.1)" />
<ScreenInfo2 />
<View style={styles.controls} >
<Button
title="Start"
onPress={() => startTrip() }
/>
<Button
title="Pause"
onPress={() => pauseTrip()}
/>
<Button
title="Stop"
onPress={() => endTrip() }
/>
</View>
<View>
<Text style={styles.tripText}>
{'Elapsed - '}{thisTrip.elapsed}{' seconds\n'}
{'Geo: '}{'lat: '}{thisTrip.loc.mLatitude}{' long: '}{thisTrip.loc.mLatitude}{'\n'}
{'Vector: '}{'distance: '}{thisTrip.distance}{' velocity: '}{thisTrip.v}{'\n'}
</Text>
</View>
< thisTrip.TripDisplay />
</View>
);