update to current expo

This commit is contained in:
Ren Juan 2021-08-22 04:30:04 +00:00
parent aa55906a14
commit 9bbfaf7cfe
13 changed files with 241 additions and 150 deletions

View File

@ -4,12 +4,14 @@ import React, { useState, useEffect } from 'react';
import { Text } from 'react-native'; import { Text } from 'react-native';
import * as Location from 'expo-location'; import * as Location from 'expo-location';
import { SafeAreaProvider } from 'react-native-safe-area-context'; import { SafeAreaProvider } from 'react-native-safe-area-context';
import useCachedResources from './hooks/useCachedResources'; import useCachedResources from './hooks/useCachedResources';
import useColorScheme from './hooks/useColorScheme'; import useColorScheme from './hooks/useColorScheme';
import Navigation from './navigation'; import Navigation from './navigation';
import { GT2 } from './GT2';
export var debug:boolean = false; export var debug:boolean = false;
export var expoGeoState:any; export var lastLoc:any;
var expoGeoState:any;
export default function App() { export default function App() {
const isLoadingComplete = useCachedResources(); const isLoadingComplete = useCachedResources();
@ -36,6 +38,7 @@ export default function App() {
if (errorMsg) { if (errorMsg) {
expoGeoState = errorMsg; expoGeoState = errorMsg;
} else if (location) { } else if (location) {
lastLoc = location;
expoGeoState = JSON.stringify(location); expoGeoState = JSON.stringify(location);
} }

View File

@ -14,6 +14,9 @@ const styles = StyleSheet.create({
fontWeight: 'bold', fontWeight: 'bold',
}}); }});
var lastLoc:any = null;
const heartbeat:number = 500;
class Chronometer { class Chronometer {
public display:string = ""; public display:string = "";
@ -25,12 +28,12 @@ class Chronometer {
hours = this.clock < 3600 ? 0 : (this.clock / 3600); hours = this.clock < 3600 ? 0 : (this.clock / 3600);
minutes = this.clock < 60 ? 0 : (this.clock - (hours * 3600)) / 60; minutes = this.clock < 60 ? 0 : (this.clock - (hours * 3600)) / 60;
seconds = this.clock % 60; seconds = this.clock % 60;
this.display = hours + ":" + minutes + ":" + seconds; this.display = hours + ":" + minutes + ":" + seconds;
} }
public start() { this.clock = 0; public start() { this.clock = 0;
this.intervalID = setInterval(this.tick, 1000); this.intervalID = setInterval(this.tick, heartbeat);
} }
public resume() { this.intervalID = setInterval(this.tick, 1000); } public resume() { this.intervalID = setInterval(this.tick, heartbeat); }
public stop() { clearInterval(this.intervalID); } public stop() { clearInterval(this.intervalID); }
} }
@ -52,6 +55,7 @@ export class GT2 {
public elapsed:number = 0.0; public elapsed:number = 0.0;
segments:number = 1; segments:number = 1;
public reset() { public reset() {
this.startPoint = new Coordinate(0,0); this.startPoint = new Coordinate(0,0);
@ -94,28 +98,16 @@ export class GT2 {
} }
public TripDisplay() { public tripDisplay() {
var tripPanel:string = ""; return(
<View>
if (!thisTrip.inProgress) <Text style={styles.tripText}>
return ( {' No trip started yet.\n'}
<View> </Text>
<Text style={styles.tripText}> </View> );
{' No trip started yet.\n'}
</Text>
</View>);
else
return (
<View>
<Text style={styles.tripText}>
{'Elapsed - '}{this.clock.display}{'\n'}
{'Geo: '}{'lat: '}{this.loc.mLatitude}{' long: '}{this.loc.mLatitude}{'\n'}
{'Vector: '}{'distance: '}{this.distance}{' velocity: '}{this.v}{'\n'}
</Text>
</View>);
} }
} }
export var thisTrip:GT2 = new GT2(); export var ThisTrip:GT2 = new GT2();

View File

@ -13,7 +13,7 @@ export default function ScreenInfo() {
style={styles.settingsText} style={styles.settingsText}
lightColor="rgba(0,0,0,0.8)" lightColor="rgba(0,0,0,0.8)"
darkColor="rgba(255,255,255,0.8)"> darkColor="rgba(255,255,255,0.8)">
Switch dark km/ light mi, select fuel used, or manually set CO2 per distance Switch dark km/ light mi, select fuel used, or specify CO2 g per distance
</Text> </Text>
</View> </View>
); );

View File

@ -1,4 +1,4 @@
import { Ionicons } from '@expo/vector-icons'; import { FontAwesome } from '@expo/vector-icons';
import * as Font from 'expo-font'; import * as Font from 'expo-font';
import * as HomeScreen from 'expo-splash-screen'; import * as HomeScreen from 'expo-splash-screen';
import * as React from 'react'; import * as React from 'react';
@ -14,7 +14,7 @@ export default function useCachedResources() {
// Load fonts // Load fonts
await Font.loadAsync({ await Font.loadAsync({
...Ionicons.font, ...FontAwesome.font,
'space-mono': require('../assets/fonts/SpaceMono-Regular.ttf'), 'space-mono': require('../assets/fonts/SpaceMono-Regular.ttf'),
}); });
} catch (e) { } catch (e) {

View File

@ -4,9 +4,12 @@
* https://reactnavigation.org/docs/configuring-links * https://reactnavigation.org/docs/configuring-links
*/ */
import { LinkingOptions } from '@react-navigation/native';
import * as Linking from 'expo-linking'; import * as Linking from 'expo-linking';
export default { import { RootStackParamList } from '../types';
const linking: LinkingOptions<RootStackParamList> = {
prefixes: [Linking.makeUrl('/')], prefixes: [Linking.makeUrl('/')],
config: { config: {
screens: { screens: {
@ -29,7 +32,10 @@ export default {
}, },
}, },
}, },
Modal: 'modal',
NotFound: '*', NotFound: '*',
}, },
}, },
}; };
export default linking;

View File

@ -1,16 +1,23 @@
/** /**
* If you are not familiar with React Navigation, check out the "Fundamentals" guide: * If you are not familiar with React Navigation, refer to the "Fundamentals" guide:
* https://reactnavigation.org/docs/getting-started * https://reactnavigation.org/docs/getting-started
* *
*/ */
import { FontAwesome } from '@expo/vector-icons';
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
import { NavigationContainer, DefaultTheme, DarkTheme } from '@react-navigation/native'; import { NavigationContainer, DefaultTheme, DarkTheme } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack'; import { createNativeStackNavigator } from '@react-navigation/native-stack';
import * as React from 'react'; import * as React from 'react';
import { ColorSchemeName } from 'react-native'; import { ColorSchemeName, Pressable } from 'react-native';
import Colors from '../constants/Colors';
import useColorScheme from '../hooks/useColorScheme';
import ModalScreen from '../screens/ModalScreen';
import NotFoundScreen from '../screens/NotFoundScreen'; import NotFoundScreen from '../screens/NotFoundScreen';
import { RootStackParamList } from '../types'; import TripScreen from '../screens/TripScreen';
import BottomTabNavigator from './BottomTabNavigator'; import HomeScreen from '../screens/HomeScreen';
import SettingsScreen from '../screens/SettingsScreen';
import { RootStackParamList, RootTabParamList, RootTabScreenProps } from '../types';
import LinkingConfiguration from './LinkingConfiguration'; import LinkingConfiguration from './LinkingConfiguration';
export default function Navigation({ colorScheme }: { colorScheme: ColorSchemeName }) { export default function Navigation({ colorScheme }: { colorScheme: ColorSchemeName }) {
@ -23,15 +30,86 @@ export default function Navigation({ colorScheme }: { colorScheme: ColorSchemeNa
); );
} }
// A root stack navigator is often used for displaying modals on top of all other content /**
// Read more here: https://reactnavigation.org/docs/modal * A root stack navigator is often used for displaying modals on top of all other content.
const Stack = createStackNavigator<RootStackParamList>(); * https://reactnavigation.org/docs/modal
*/
const Stack = createNativeStackNavigator<RootStackParamList>();
function RootNavigator() { function RootNavigator() {
return ( return (
<Stack.Navigator screenOptions={{ headerShown: false }}> <Stack.Navigator>
<Stack.Screen name="Root" component={BottomTabNavigator} /> <Stack.Screen name="Root" component={BottomTabNavigator} options={{ headerShown: false }} />
<Stack.Screen name="NotFound" component={NotFoundScreen} options={{ title: 'Oops!' }} /> <Stack.Screen name="NotFound" component={NotFoundScreen} options={{ title: 'Oops!' }} />
<Stack.Group screenOptions={{ presentation: 'modal' }}>
</Stack.Group>
</Stack.Navigator> </Stack.Navigator>
); );
} }
/**
* A bottom tab navigator displays tab buttons on the bottom of the display to switch screens.
* https://reactnavigation.org/docs/bottom-tab-navigator
*/
const BottomTab = createBottomTabNavigator<RootTabParamList>();
function BottomTabNavigator() {
const colorScheme = useColorScheme();
return (
<BottomTab.Navigator
initialRouteName="Home"
screenOptions={{
tabBarActiveTintColor: Colors[colorScheme].tint,
}}>
<BottomTab.Screen
name="Home"
component={HomeScreen}
options={({ navigation }: RootTabScreenProps<'Home'>) => ({
title: 'Home',
tabBarIcon: ({ color }) => <TabBarIcon name="code" color={color} />,
headerRight: () => (
<Pressable
onPress={() => navigation.navigate('Modal')}
style={({ pressed }) => ({
opacity: pressed ? 0.5 : 1,
})}>
<FontAwesome
name="info-circle"
size={25}
color={Colors[colorScheme].text}
style={{ marginRight: 15 }}
/>
</Pressable>
),
})}
/>
<BottomTab.Screen
name="Settings"
component={SettingsScreen}
options={{
title: 'Settings',
tabBarIcon: ({ color }) => <TabBarIcon name="code" color={color} />,
}}
/>
<BottomTab.Screen
name="Trip"
component={TripScreen}
options={{
title: 'Trip',
tabBarIcon: ({ color }) => <TabBarIcon name="code" color={color} />,
}}
/>
</BottomTab.Navigator>
);
}
/**
* You can explore the built-in icon families and icons on the web at https://icons.expo.fyi/
*/
function TabBarIcon(props: {
name: React.ComponentProps<typeof FontAwesome>['name'];
color: string;
}) {
return <FontAwesome size={30} style={{ marginBottom: -3 }} {...props} />;
}

View File

@ -1256,12 +1256,12 @@
} }
}, },
"@expo/config": { "@expo/config": {
"version": "5.0.7", "version": "5.0.8",
"resolved": "https://registry.npmjs.org/@expo/config/-/config-5.0.7.tgz", "resolved": "https://registry.npmjs.org/@expo/config/-/config-5.0.8.tgz",
"integrity": "sha512-7Wzao9uALHmRSf59FMsHk1vxW4m4alDCJmfo+enXnl5o6UYiCDYfjNXctMwnW+fBM3opta4FbmmPGIftfXOesw==", "integrity": "sha512-chxcjQh4H/suzvYi+p30VnGXSHbsiVsGFwEYIZbOw4ByjrCnzeD644KolbpeQ2/oWK3atci01Qcxc1TADSixHQ==",
"requires": { "requires": {
"@babel/code-frame": "~7.10.4", "@babel/code-frame": "~7.10.4",
"@expo/config-plugins": "3.0.7", "@expo/config-plugins": "3.0.8",
"@expo/config-types": "^42.0.0", "@expo/config-types": "^42.0.0",
"@expo/json-file": "8.2.33", "@expo/json-file": "8.2.33",
"getenv": "^1.0.0", "getenv": "^1.0.0",
@ -1274,9 +1274,9 @@
} }
}, },
"@expo/config-plugins": { "@expo/config-plugins": {
"version": "3.0.7", "version": "3.0.8",
"resolved": "https://registry.npmjs.org/@expo/config-plugins/-/config-plugins-3.0.7.tgz", "resolved": "https://registry.npmjs.org/@expo/config-plugins/-/config-plugins-3.0.8.tgz",
"integrity": "sha512-7YOoFtxB6XqDil+OlGXi7iredKHxXVFCAOIVfFyEDzO3oo0gBmWGmUnHgrPDvpMj0q+adCCh5BL8OcvGfc9ITQ==", "integrity": "sha512-reNYaYklOIq8QUY5ua1ubSRhVgY7hllvjingo22HHSaGhX4UvFFKDGYrjBdjcutHD6jw/eYLa8yJS74o1/rqkg==",
"requires": { "requires": {
"@expo/config-types": "^42.0.0", "@expo/config-types": "^42.0.0",
"@expo/json-file": "8.2.33", "@expo/json-file": "8.2.33",
@ -1366,11 +1366,11 @@
} }
}, },
"@expo/metro-config": { "@expo/metro-config": {
"version": "0.1.82", "version": "0.1.83",
"resolved": "https://registry.npmjs.org/@expo/metro-config/-/metro-config-0.1.82.tgz", "resolved": "https://registry.npmjs.org/@expo/metro-config/-/metro-config-0.1.83.tgz",
"integrity": "sha512-rgx0ykWFvu+7jXDSe/cJB0fpIKqJX4X2k+azBIS9KmVLl5/ceKuCr6Abjy70HZTAXX/SQ7fS0C+FhzIX2Upgrg==", "integrity": "sha512-nbmHRzAjnUmUoQjbVdTh8Xq1AXABmwqDi77otD+MxxfVmppMYLKYfMteZnrl75tmWkQY4JfVLD4DfKA3K+bKGA==",
"requires": { "requires": {
"@expo/config": "5.0.7", "@expo/config": "5.0.8",
"chalk": "^4.1.0", "chalk": "^4.1.0",
"getenv": "^1.0.0", "getenv": "^1.0.0",
"metro-react-native-babel-transformer": "^0.59.0" "metro-react-native-babel-transformer": "^0.59.0"
@ -1387,12 +1387,12 @@
} }
}, },
"@expo/prebuild-config": { "@expo/prebuild-config": {
"version": "2.0.7", "version": "2.0.8",
"resolved": "https://registry.npmjs.org/@expo/prebuild-config/-/prebuild-config-2.0.7.tgz", "resolved": "https://registry.npmjs.org/@expo/prebuild-config/-/prebuild-config-2.0.8.tgz",
"integrity": "sha512-EMgo4ywR9hk+I90XEwtl/UHWOlw8GE01BQtrLWQbIR0pr+bvDOYINfe8PzA21oODPGUkbMvp5Z8E79VZBqqjfg==", "integrity": "sha512-mPL7rsZkybohTskB3SdepZx27LM94No3cmS4DLPFxWbtv4gJn7RL+e4eWmIkj2vOGuDnGRwiui7Hh7SFVvRsrg==",
"requires": { "requires": {
"@expo/config": "5.0.7", "@expo/config": "5.0.8",
"@expo/config-plugins": "3.0.7", "@expo/config-plugins": "3.0.8",
"@expo/config-types": "^42.0.0", "@expo/config-types": "^42.0.0",
"@expo/image-utils": "0.3.16", "@expo/image-utils": "0.3.16",
"@expo/json-file": "8.2.33", "@expo/json-file": "8.2.33",
@ -3692,57 +3692,68 @@
"resolved": "https://registry.npmjs.org/@react-native-community/cli-types/-/cli-types-4.10.1.tgz", "resolved": "https://registry.npmjs.org/@react-native-community/cli-types/-/cli-types-4.10.1.tgz",
"integrity": "sha512-ael2f1onoPF3vF7YqHGWy7NnafzGu+yp88BbFbP0ydoCP2xGSUzmZVw0zakPTC040Id+JQ9WeFczujMkDy6jYQ==" "integrity": "sha512-ael2f1onoPF3vF7YqHGWy7NnafzGu+yp88BbFbP0ydoCP2xGSUzmZVw0zakPTC040Id+JQ9WeFczujMkDy6jYQ=="
}, },
"@react-native-community/masked-view": {
"version": "0.1.10",
"resolved": "https://registry.npmjs.org/@react-native-community/masked-view/-/masked-view-0.1.10.tgz",
"integrity": "sha512-rk4sWFsmtOw8oyx8SD3KSvawwaK7gRBSEIy2TAwURyGt+3TizssXP1r8nx3zY+R7v2vYYHXZ+k2/GULAT/bcaQ=="
},
"@react-navigation/bottom-tabs": { "@react-navigation/bottom-tabs": {
"version": "5.11.2", "version": "6.0.5",
"resolved": "https://registry.npmjs.org/@react-navigation/bottom-tabs/-/bottom-tabs-5.11.2.tgz", "resolved": "https://registry.npmjs.org/@react-navigation/bottom-tabs/-/bottom-tabs-6.0.5.tgz",
"integrity": "sha512-7+hH00N9Ze74VcX8uYWVyXFXZ0Fwid+lG+SSLtmnJjk1Y6oIQpQ17EPqKO0UZlKKjhsvMlAnL5fdgFtoqnSjcA==", "integrity": "sha512-GytjJUzacHhe3C24HFrPl881Donrw2m+3JBNqMJALxMRjSA8yY72+l16bZR9YFsrywSHVSbjxIfzqtGb8rIVJg==",
"requires": { "requires": {
"@react-navigation/elements": "^1.1.0",
"color": "^3.1.3", "color": "^3.1.3",
"react-native-iphone-x-helper": "^1.3.0" "warn-once": "^0.1.0"
} }
}, },
"@react-navigation/core": { "@react-navigation/core": {
"version": "5.16.0", "version": "6.0.1",
"resolved": "https://registry.npmjs.org/@react-navigation/core/-/core-5.16.0.tgz", "resolved": "https://registry.npmjs.org/@react-navigation/core/-/core-6.0.1.tgz",
"integrity": "sha512-dy/sfO2Tl41r3vB2uUXTh6d9HY7Q2i43CxfqsU4fnGw5QRmp+7LaMidhGYOoH1wJ50IMWoBC2TdAr0x+5iluHg==", "integrity": "sha512-mVdvBDYdz8uzLQHokmVdX/xC4rS7NIkD1FN/yaGdovVzYApAhM+UGd3w1zskjyCSyXaVHHOwV59ZGVew+84xfQ==",
"requires": { "requires": {
"@react-navigation/routers": "^5.7.4", "@react-navigation/routers": "^6.0.1",
"escape-string-regexp": "^4.0.0", "escape-string-regexp": "^4.0.0",
"nanoid": "^3.1.15", "nanoid": "^3.1.23",
"query-string": "^6.13.6", "query-string": "^7.0.0",
"react-is": "^16.13.0" "react-is": "^16.13.0"
} }
}, },
"@react-navigation/elements": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@react-navigation/elements/-/elements-1.1.0.tgz",
"integrity": "sha512-jZncciZPGuoP6B6f+Wpf6MYSSYy86B2HJDbFTCtT5xZV0w6V9GgCeqvSTOEAxifZrmKl8uDxsr0GrIxgQE8NxA=="
},
"@react-navigation/native": { "@react-navigation/native": {
"version": "5.8.10", "version": "6.0.2",
"resolved": "https://registry.npmjs.org/@react-navigation/native/-/native-5.8.10.tgz", "resolved": "https://registry.npmjs.org/@react-navigation/native/-/native-6.0.2.tgz",
"integrity": "sha512-OUgD1o+y7PwmhRIRqQxN0SQvVU/SHic/ek/qMvBZX8nu5/WlBNxmNRMHVxONgHlG3AQZh27NUs9ynntL7ek1zQ==", "integrity": "sha512-HDqEwgvQ4Cu16vz8jQ55lfyNK9CGbECI1wM9cPOcUa+gkOQEDZ/95VFfFjGGflXZs3ybPvGXlMC4ZAyh1CcO6w==",
"requires": { "requires": {
"@react-navigation/core": "^5.14.4", "@react-navigation/core": "^6.0.1",
"escape-string-regexp": "^4.0.0", "escape-string-regexp": "^4.0.0",
"nanoid": "^3.1.15" "nanoid": "^3.1.23"
}
},
"@react-navigation/native-stack": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/@react-navigation/native-stack/-/native-stack-6.1.0.tgz",
"integrity": "sha512-ta8JQ9n6e7pxrXJ9/MYH57g0xhlV8rzGvQtni6KvBdWqqk0M5QDqIXaUkzXp2wvLMZp7LQmnD4FI/TGG2mQOKA==",
"requires": {
"@react-navigation/elements": "^1.1.0",
"warn-once": "^0.1.0"
} }
}, },
"@react-navigation/routers": { "@react-navigation/routers": {
"version": "5.7.4", "version": "6.0.1",
"resolved": "https://registry.npmjs.org/@react-navigation/routers/-/routers-5.7.4.tgz", "resolved": "https://registry.npmjs.org/@react-navigation/routers/-/routers-6.0.1.tgz",
"integrity": "sha512-0N202XAqsU/FlE53Nmh6GHyMtGm7g6TeC93mrFAFJOqGRKznT0/ail+cYlU6tNcPA9AHzZu1Modw1eoDINSliQ==", "integrity": "sha512-5ctB49rmtTRQuTSBVgqMsEzBUjPP2ByUzBjNivA7jmvk+PDCl4oZsiR8KAm/twhxe215GYThfi2vUWXKAg6EEQ==",
"requires": { "requires": {
"nanoid": "^3.1.15" "nanoid": "^3.1.23"
} }
}, },
"@react-navigation/stack": { "@react-navigation/stack": {
"version": "5.12.8", "version": "6.0.7",
"resolved": "https://registry.npmjs.org/@react-navigation/stack/-/stack-5.12.8.tgz", "resolved": "https://registry.npmjs.org/@react-navigation/stack/-/stack-6.0.7.tgz",
"integrity": "sha512-wUJFbU0v606RBXOUxHToCXJNmiwxtFYhN2TFvjxCZ3PJU+OWWx8HTmn99pT3rVH4Ax2cfO5BDUy9v+r74ZrIWw==", "integrity": "sha512-hxwhRZbn6zD2rInhItBeHTCPYzmurz+/8/MhtRevBEdLG0+61dik8Y+evg/mu6AsOU0WrDakTsLcHdf/9zkXzw==",
"requires": { "requires": {
"@react-navigation/elements": "^1.1.0",
"color": "^3.1.3", "color": "^3.1.3",
"react-native-iphone-x-helper": "^1.3.0" "warn-once": "^0.1.0"
} }
}, },
"@sinonjs/commons": { "@sinonjs/commons": {
@ -3831,9 +3842,9 @@
} }
}, },
"@types/node": { "@types/node": {
"version": "16.6.1", "version": "16.7.1",
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.6.1.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-16.7.1.tgz",
"integrity": "sha512-Sr7BhXEAer9xyGuCN3Ek9eg9xPviCF2gfu9kTfuU2HkTVAMYSDeX40fvpmo72n5nansg3nsBjuQBrsS28r+NUw==" "integrity": "sha512-ncRdc45SoYJ2H4eWU9ReDfp3vtFqDYhjOsKlFFUDEn8V1Bgr2RjYal8YT5byfadWIRluhPFU6JiDOl0H6Sl87A=="
}, },
"@types/normalize-package-data": { "@types/normalize-package-data": {
"version": "2.4.1", "version": "2.4.1",
@ -4692,15 +4703,15 @@
} }
}, },
"browserslist": { "browserslist": {
"version": "4.16.7", "version": "4.16.8",
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.16.7.tgz", "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.16.8.tgz",
"integrity": "sha512-7I4qVwqZltJ7j37wObBe3SoTz+nS8APaNcrBOlgoirb6/HbEU2XxW/LpUDTCngM6iauwFqmRTuOMfyKnFGY5JA==", "integrity": "sha512-sc2m9ohR/49sWEbPj14ZSSZqp+kbi16aLao42Hmn3Z8FpjuMaq2xCA2l4zl9ITfyzvnvyE0hcg62YkIGKxgaNQ==",
"requires": { "requires": {
"caniuse-lite": "^1.0.30001248", "caniuse-lite": "^1.0.30001251",
"colorette": "^1.2.2", "colorette": "^1.3.0",
"electron-to-chromium": "^1.3.793", "electron-to-chromium": "^1.3.811",
"escalade": "^3.1.1", "escalade": "^3.1.1",
"node-releases": "^1.1.73" "node-releases": "^1.1.75"
} }
}, },
"bser": { "bser": {
@ -5162,9 +5173,9 @@
"integrity": "sha1-ZSKUwUZR2yj6k70tX/KYOk8IxjY=" "integrity": "sha1-ZSKUwUZR2yj6k70tX/KYOk8IxjY="
}, },
"core-js-compat": { "core-js-compat": {
"version": "3.16.1", "version": "3.16.2",
"resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.16.1.tgz", "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.16.2.tgz",
"integrity": "sha512-NHXQXvRbd4nxp9TEmooTJLUf94ySUG6+DSsscBpTftN1lQLQ4LjnWvc7AoIo4UjDsFF3hB8Uh5LLCRRdaiT5MQ==", "integrity": "sha512-4lUshXtBXsdmp8cDWh6KKiHUg40AjiuPD3bOWkNVsr1xkAhpUqCjaZ8lB1bKx9Gb5fXcbRbFJ4f4qpRIRTuJqQ==",
"requires": { "requires": {
"browserslist": "^4.16.7", "browserslist": "^4.16.7",
"semver": "7.0.0" "semver": "7.0.0"
@ -5458,9 +5469,9 @@
"integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0="
}, },
"electron-to-chromium": { "electron-to-chromium": {
"version": "1.3.806", "version": "1.3.814",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.806.tgz", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.814.tgz",
"integrity": "sha512-AH/otJLAAecgyrYp0XK1DPiGVWcOgwPeJBOLeuFQ5l//vhQhwC9u6d+GijClqJAmsHG4XDue81ndSQPohUu0xA==" "integrity": "sha512-0mH03cyjh6OzMlmjauGg0TLd87ErIJqWiYxMcOLKf5w6p0YEOl7DJAj7BDlXEFmCguY5CQaKVOiMjAMODO2XDw=="
}, },
"emoji-regex": { "emoji-regex": {
"version": "8.0.0", "version": "8.0.0",
@ -6291,9 +6302,9 @@
"dev": true "dev": true
}, },
"fastq": { "fastq": {
"version": "1.11.1", "version": "1.12.0",
"resolved": "https://registry.npmjs.org/fastq/-/fastq-1.11.1.tgz", "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.12.0.tgz",
"integrity": "sha512-HOnr8Mc60eNYl1gzwp6r5RoUyAn5/glBolUzP/Ez6IFVPMPirxn/9phgL6zhOtaTy7ISwPvQ+wT+hfcRZh/bzw==", "integrity": "sha512-VNX0QkHK3RsXVKr9KrlUv/FoTa0NdbYoHHl7uXHv2rzyHSlxjdNAKug2twd9luJxpcyNeAgf5iPPMutJO67Dfg==",
"requires": { "requires": {
"reusify": "^1.0.4" "reusify": "^1.0.4"
} }
@ -7073,9 +7084,9 @@
} }
}, },
"is-core-module": { "is-core-module": {
"version": "2.5.0", "version": "2.6.0",
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.5.0.tgz", "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.6.0.tgz",
"integrity": "sha512-TXCMSDsEHMEEZ6eCA8rwRDbLu55MRGmrctljsBX/2v1d9/GzqHOxW5c5oPSgrUt2vBFXebu9rGqckXGPWOlYpg==", "integrity": "sha512-wShG8vs60jKfPWpF2KZRaAtvt3a20OAn7+IJ6hLPECpSABLcKtFKTTI4ZtH5QcBruBHlq+WsdHWyz0BCZW7svQ==",
"requires": { "requires": {
"has": "^1.0.3" "has": "^1.0.3"
} }
@ -12217,9 +12228,9 @@
} }
}, },
"node-releases": { "node-releases": {
"version": "1.1.74", "version": "1.1.75",
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.74.tgz", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.75.tgz",
"integrity": "sha512-caJBVempXZPepZoZAPCWRTNxYQ+xtG/KAi4ozTA5A+nJ7IU+kLQCbqaUjb5Rwy14M9upBWiQ4NutcmW04LJSRw==" "integrity": "sha512-Qe5OUajvqrqDSy6wrWFmMwfJ0jVgwiw4T3KqmbTcZ62qW0gQkheXYhcFM1+lOVcGUoRxcEcfyvFMAnDgaF1VWw=="
}, },
"node-stream-zip": { "node-stream-zip": {
"version": "1.14.0", "version": "1.14.0",
@ -12970,9 +12981,9 @@
} }
}, },
"query-string": { "query-string": {
"version": "6.14.1", "version": "7.0.1",
"resolved": "https://registry.npmjs.org/query-string/-/query-string-6.14.1.tgz", "resolved": "https://registry.npmjs.org/query-string/-/query-string-7.0.1.tgz",
"integrity": "sha512-XDxAeVmpfu1/6IjyT/gXHOl+S0vQ9owggJ30hhWKdHAsNPOcasn5o9BW0eejZqL2e4vMjhAxoW3jVHcD6mbcYw==", "integrity": "sha512-uIw3iRvHnk9to1blJCG3BTc+Ro56CBowJXKmNNAm3RulvPBzWLRqKSiiDk+IplJhsydwtuNMHi8UGQFcCLVfkA==",
"requires": { "requires": {
"decode-uri-component": "^0.2.0", "decode-uri-component": "^0.2.0",
"filter-obj": "^1.1.0", "filter-obj": "^1.1.0",
@ -13384,11 +13395,6 @@
} }
} }
}, },
"react-native-iphone-x-helper": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/react-native-iphone-x-helper/-/react-native-iphone-x-helper-1.3.1.tgz",
"integrity": "sha512-HOf0jzRnq2/aFUcdCJ9w9JGzN3gdEg0zFE4FyYlp4jtidqU03D5X7ZegGKfT1EWteR0gPBGp9ye5T5FvSWi9Yg=="
},
"react-native-reanimated": { "react-native-reanimated": {
"version": "2.2.0", "version": "2.2.0",
"resolved": "https://registry.npmjs.org/react-native-reanimated/-/react-native-reanimated-2.2.0.tgz", "resolved": "https://registry.npmjs.org/react-native-reanimated/-/react-native-reanimated-2.2.0.tgz",

View File

@ -13,10 +13,10 @@
}, },
"dependencies": { "dependencies": {
"@expo/vector-icons": "^12.0.0", "@expo/vector-icons": "^12.0.0",
"@react-native-community/masked-view": "0.1.10", "@react-navigation/bottom-tabs": "^6.0.5",
"@react-navigation/bottom-tabs": "5.11.2", "@react-navigation/native": "^6.0.2",
"@react-navigation/native": "~5.8.10", "@react-navigation/native-stack": "^6.1.0",
"@react-navigation/stack": "~5.12.8", "@react-navigation/stack": "^6.0.7",
"expo": "~42.0.1", "expo": "~42.0.1",
"expo-asset": "~8.3.2", "expo-asset": "~8.3.2",
"expo-constants": "~11.0.1", "expo-constants": "~11.0.1",

View File

@ -1,12 +1,9 @@
import { StackScreenProps } from '@react-navigation/stack';
import * as React from 'react'; import * as React from 'react';
import { StyleSheet, Text, TouchableOpacity, View } from 'react-native'; import { StyleSheet, Text, TouchableOpacity, View } from 'react-native';
import { RootStackParamList } from '../types'; import { RootStackScreenProps } from '../types';
export default function NotFoundScreen({ export default function NotFoundScreen({ navigation }: RootStackScreenProps<'NotFound'>) {
navigation,
}: StackScreenProps<RootStackParamList, 'NotFound'>) {
return ( return (
<View style={styles.container}> <View style={styles.container}>
<Text style={styles.title}>This screen doesn't exist.</Text> <Text style={styles.title}>This screen doesn't exist.</Text>

View File

@ -42,7 +42,7 @@ export default function SettingsScreen() {
returnKeyType={'done'} returnKeyType={'done'}
onChangeText={onChangeNumber} onChangeText={onChangeNumber}
value={number} value={number}
placeholder="0.67" placeholder="250"
keyboardType="numeric" keyboardType="numeric"
/> />
</View> </View>

View File

@ -2,7 +2,7 @@ import * as React from 'react';
import { Button, StyleSheet, Alert } from 'react-native'; import { Button, StyleSheet, Alert } from 'react-native';
import { Text, View } from '../components/Themed'; import { Text, View } from '../components/Themed';
import { ScreenInfo2 } from '../components/ScreenInfo'; import { ScreenInfo2 } from '../components/ScreenInfo';
import { GT2, thisTrip } from '../GT2'; import { ThisTrip } from '../GT2';
const styles = StyleSheet.create({ const styles = StyleSheet.create({
container: { container: {
@ -29,21 +29,21 @@ const styles = StyleSheet.create({
function startTrip() { function startTrip() {
thisTrip.start(); ThisTrip.start();
Alert.alert('Trip Started'); Alert.alert('Trip Started');
} }
function pauseTrip() { function pauseTrip() {
thisTrip.pause(); ThisTrip.pause();
Alert.alert('Trip Paused'); Alert.alert('Trip Paused');
} }
function endTrip() { function endTrip() {
thisTrip.end(); ThisTrip.end();
Alert.alert('Trip Ended'); Alert.alert('Trip Ended');
} }
@ -69,7 +69,7 @@ export default function TripScreen() {
onPress={() => endTrip() } onPress={() => endTrip() }
/> />
</View> </View>
< thisTrip.TripDisplay /> < ThisTrip.tripDisplay />
</View> </View>
); );

View File

@ -1,6 +1,6 @@
{ {
"extends": "expo/tsconfig.base", "extends": "expo/tsconfig.base",
"compilerOptions": { "compilerOptions": {
"strict": true "strict": true
} }
} }

View File

@ -3,25 +3,34 @@
* https://reactnavigation.org/docs/typescript/ * https://reactnavigation.org/docs/typescript/
*/ */
import { BottomTabScreenProps } from '@react-navigation/bottom-tabs';
import { CompositeScreenProps, NavigatorScreenParams } from '@react-navigation/native';
import { NativeStackScreenProps } from '@react-navigation/native-stack';
declare global {
namespace ReactNavigation {
interface RootParamList extends RootStackParamList {}
}
}
export type RootStackParamList = { export type RootStackParamList = {
Root: undefined; Root: NavigatorScreenParams<RootTabParamList> | undefined;
Modal: undefined;
NotFound: undefined; NotFound: undefined;
}; };
export type BottomTabParamList = { export type RootStackScreenProps<Screen extends keyof RootStackParamList> = NativeStackScreenProps<
RootStackParamList,
Screen
>;
export type RootTabParamList = {
Home: undefined; Home: undefined;
Trip: undefined;
Settings: undefined; Settings: undefined;
Trip: undefined;
}; };
export type TripParamList = { export type RootTabScreenProps<Screen extends keyof RootTabParamList> = CompositeScreenProps<
TripScreen: undefined; BottomTabScreenProps<RootTabParamList, Screen>,
}; NativeStackScreenProps<RootStackParamList>
>;
export type SettingsParamList = {
SettingsScreen: undefined;
};
export type HomeParamList = {
HomeScreen: undefined;
};