From 9bbfaf7cfee2912adb4e408bc67d4d6a8ede431e Mon Sep 17 00:00:00 2001 From: Ren Juan Date: Sun, 22 Aug 2021 04:30:04 +0000 Subject: [PATCH] update to current expo --- Ejectable/App.tsx | 7 +- Ejectable/GT2.tsx | 42 ++--- Ejectable/components/ScreenInfo.tsx | 2 +- Ejectable/hooks/useCachedResources.ts | 4 +- Ejectable/navigation/LinkingConfiguration.ts | 8 +- Ejectable/navigation/index.tsx | 98 ++++++++++-- Ejectable/package-lock.json | 160 ++++++++++--------- Ejectable/package.json | 8 +- Ejectable/screens/NotFoundScreen.tsx | 7 +- Ejectable/screens/SettingsScreen.tsx | 2 +- Ejectable/screens/TripScreen.tsx | 10 +- Ejectable/tsconfig.json | 6 +- Ejectable/types.tsx | 37 +++-- 13 files changed, 241 insertions(+), 150 deletions(-) diff --git a/Ejectable/App.tsx b/Ejectable/App.tsx index 32e339e2..3e1003e9 100644 --- a/Ejectable/App.tsx +++ b/Ejectable/App.tsx @@ -4,12 +4,14 @@ import React, { useState, useEffect } from 'react'; import { Text } from 'react-native'; import * as Location from 'expo-location'; import { SafeAreaProvider } from 'react-native-safe-area-context'; + import useCachedResources from './hooks/useCachedResources'; import useColorScheme from './hooks/useColorScheme'; import Navigation from './navigation'; -import { GT2 } from './GT2'; + export var debug:boolean = false; -export var expoGeoState:any; +export var lastLoc:any; + var expoGeoState:any; export default function App() { const isLoadingComplete = useCachedResources(); @@ -36,6 +38,7 @@ export default function App() { if (errorMsg) { expoGeoState = errorMsg; } else if (location) { + lastLoc = location; expoGeoState = JSON.stringify(location); } diff --git a/Ejectable/GT2.tsx b/Ejectable/GT2.tsx index ce346cde..9717edbb 100644 --- a/Ejectable/GT2.tsx +++ b/Ejectable/GT2.tsx @@ -14,6 +14,9 @@ const styles = StyleSheet.create({ fontWeight: 'bold', }}); +var lastLoc:any = null; +const heartbeat:number = 500; + class Chronometer { public display:string = ""; @@ -25,12 +28,12 @@ class Chronometer { hours = this.clock < 3600 ? 0 : (this.clock / 3600); minutes = this.clock < 60 ? 0 : (this.clock - (hours * 3600)) / 60; seconds = this.clock % 60; - this.display = hours + ":" + minutes + ":" + seconds; + this.display = hours + ":" + minutes + ":" + seconds; } 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); } } @@ -52,6 +55,7 @@ export class GT2 { public elapsed:number = 0.0; segments:number = 1; + public reset() { this.startPoint = new Coordinate(0,0); @@ -94,28 +98,16 @@ export class GT2 { } - public TripDisplay() { - - var tripPanel:string = ""; - - if (!thisTrip.inProgress) - return ( - - - {' No trip started yet.\n'} - - ); - else - return ( - - - {'Elapsed - '}{this.clock.display}{'\n'} - {'Geo: '}{'lat: '}{this.loc.mLatitude}{' long: '}{this.loc.mLatitude}{'\n'} - {'Vector: '}{'distance: '}{this.distance}{' velocity: '}{this.v}{'\n'} - - ); + public tripDisplay() { + + return( + + + {' No trip started yet.\n'} + + ); } } - -export var thisTrip:GT2 = new GT2(); + +export var ThisTrip:GT2 = new GT2(); diff --git a/Ejectable/components/ScreenInfo.tsx b/Ejectable/components/ScreenInfo.tsx index f8b2bf9f..6c768342 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)"> - 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 ); diff --git a/Ejectable/hooks/useCachedResources.ts b/Ejectable/hooks/useCachedResources.ts index 57541869..c22248d7 100644 --- a/Ejectable/hooks/useCachedResources.ts +++ b/Ejectable/hooks/useCachedResources.ts @@ -1,4 +1,4 @@ -import { Ionicons } from '@expo/vector-icons'; +import { FontAwesome } from '@expo/vector-icons'; import * as Font from 'expo-font'; import * as HomeScreen from 'expo-splash-screen'; import * as React from 'react'; @@ -14,7 +14,7 @@ export default function useCachedResources() { // Load fonts await Font.loadAsync({ - ...Ionicons.font, + ...FontAwesome.font, 'space-mono': require('../assets/fonts/SpaceMono-Regular.ttf'), }); } catch (e) { diff --git a/Ejectable/navigation/LinkingConfiguration.ts b/Ejectable/navigation/LinkingConfiguration.ts index 22b649bf..43bf54cf 100644 --- a/Ejectable/navigation/LinkingConfiguration.ts +++ b/Ejectable/navigation/LinkingConfiguration.ts @@ -4,9 +4,12 @@ * https://reactnavigation.org/docs/configuring-links */ +import { LinkingOptions } from '@react-navigation/native'; import * as Linking from 'expo-linking'; -export default { +import { RootStackParamList } from '../types'; + +const linking: LinkingOptions = { prefixes: [Linking.makeUrl('/')], config: { screens: { @@ -29,7 +32,10 @@ export default { }, }, }, + Modal: 'modal', NotFound: '*', }, }, }; + +export default linking; diff --git a/Ejectable/navigation/index.tsx b/Ejectable/navigation/index.tsx index f91103aa..b591fdfa 100644 --- a/Ejectable/navigation/index.tsx +++ b/Ejectable/navigation/index.tsx @@ -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 * */ +import { FontAwesome } from '@expo/vector-icons'; +import { createBottomTabNavigator } from '@react-navigation/bottom-tabs'; 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 { 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 { RootStackParamList } from '../types'; -import BottomTabNavigator from './BottomTabNavigator'; +import TripScreen from '../screens/TripScreen'; +import HomeScreen from '../screens/HomeScreen'; +import SettingsScreen from '../screens/SettingsScreen'; +import { RootStackParamList, RootTabParamList, RootTabScreenProps } from '../types'; import LinkingConfiguration from './LinkingConfiguration'; 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 -const Stack = createStackNavigator(); +/** + * A root stack navigator is often used for displaying modals on top of all other content. + * https://reactnavigation.org/docs/modal + */ +const Stack = createNativeStackNavigator(); function RootNavigator() { return ( - - + + + + ); } + +/** + * 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(); + +function BottomTabNavigator() { + const colorScheme = useColorScheme(); + + return ( + + ) => ({ + title: 'Home', + tabBarIcon: ({ color }) => , + headerRight: () => ( + navigation.navigate('Modal')} + style={({ pressed }) => ({ + opacity: pressed ? 0.5 : 1, + })}> + + + ), + })} + /> + , + }} + /> + , + }} + /> + + ); +} + +/** + * You can explore the built-in icon families and icons on the web at https://icons.expo.fyi/ + */ +function TabBarIcon(props: { + name: React.ComponentProps['name']; + color: string; +}) { + return ; +} diff --git a/Ejectable/package-lock.json b/Ejectable/package-lock.json index c607366f..a5271756 100644 --- a/Ejectable/package-lock.json +++ b/Ejectable/package-lock.json @@ -1256,12 +1256,12 @@ } }, "@expo/config": { - "version": "5.0.7", - "resolved": "https://registry.npmjs.org/@expo/config/-/config-5.0.7.tgz", - "integrity": "sha512-7Wzao9uALHmRSf59FMsHk1vxW4m4alDCJmfo+enXnl5o6UYiCDYfjNXctMwnW+fBM3opta4FbmmPGIftfXOesw==", + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/@expo/config/-/config-5.0.8.tgz", + "integrity": "sha512-chxcjQh4H/suzvYi+p30VnGXSHbsiVsGFwEYIZbOw4ByjrCnzeD644KolbpeQ2/oWK3atci01Qcxc1TADSixHQ==", "requires": { "@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/json-file": "8.2.33", "getenv": "^1.0.0", @@ -1274,9 +1274,9 @@ } }, "@expo/config-plugins": { - "version": "3.0.7", - "resolved": "https://registry.npmjs.org/@expo/config-plugins/-/config-plugins-3.0.7.tgz", - "integrity": "sha512-7YOoFtxB6XqDil+OlGXi7iredKHxXVFCAOIVfFyEDzO3oo0gBmWGmUnHgrPDvpMj0q+adCCh5BL8OcvGfc9ITQ==", + "version": "3.0.8", + "resolved": "https://registry.npmjs.org/@expo/config-plugins/-/config-plugins-3.0.8.tgz", + "integrity": "sha512-reNYaYklOIq8QUY5ua1ubSRhVgY7hllvjingo22HHSaGhX4UvFFKDGYrjBdjcutHD6jw/eYLa8yJS74o1/rqkg==", "requires": { "@expo/config-types": "^42.0.0", "@expo/json-file": "8.2.33", @@ -1366,11 +1366,11 @@ } }, "@expo/metro-config": { - "version": "0.1.82", - "resolved": "https://registry.npmjs.org/@expo/metro-config/-/metro-config-0.1.82.tgz", - "integrity": "sha512-rgx0ykWFvu+7jXDSe/cJB0fpIKqJX4X2k+azBIS9KmVLl5/ceKuCr6Abjy70HZTAXX/SQ7fS0C+FhzIX2Upgrg==", + "version": "0.1.83", + "resolved": "https://registry.npmjs.org/@expo/metro-config/-/metro-config-0.1.83.tgz", + "integrity": "sha512-nbmHRzAjnUmUoQjbVdTh8Xq1AXABmwqDi77otD+MxxfVmppMYLKYfMteZnrl75tmWkQY4JfVLD4DfKA3K+bKGA==", "requires": { - "@expo/config": "5.0.7", + "@expo/config": "5.0.8", "chalk": "^4.1.0", "getenv": "^1.0.0", "metro-react-native-babel-transformer": "^0.59.0" @@ -1387,12 +1387,12 @@ } }, "@expo/prebuild-config": { - "version": "2.0.7", - "resolved": "https://registry.npmjs.org/@expo/prebuild-config/-/prebuild-config-2.0.7.tgz", - "integrity": "sha512-EMgo4ywR9hk+I90XEwtl/UHWOlw8GE01BQtrLWQbIR0pr+bvDOYINfe8PzA21oODPGUkbMvp5Z8E79VZBqqjfg==", + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/@expo/prebuild-config/-/prebuild-config-2.0.8.tgz", + "integrity": "sha512-mPL7rsZkybohTskB3SdepZx27LM94No3cmS4DLPFxWbtv4gJn7RL+e4eWmIkj2vOGuDnGRwiui7Hh7SFVvRsrg==", "requires": { - "@expo/config": "5.0.7", - "@expo/config-plugins": "3.0.7", + "@expo/config": "5.0.8", + "@expo/config-plugins": "3.0.8", "@expo/config-types": "^42.0.0", "@expo/image-utils": "0.3.16", "@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", "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": { - "version": "5.11.2", - "resolved": "https://registry.npmjs.org/@react-navigation/bottom-tabs/-/bottom-tabs-5.11.2.tgz", - "integrity": "sha512-7+hH00N9Ze74VcX8uYWVyXFXZ0Fwid+lG+SSLtmnJjk1Y6oIQpQ17EPqKO0UZlKKjhsvMlAnL5fdgFtoqnSjcA==", + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/@react-navigation/bottom-tabs/-/bottom-tabs-6.0.5.tgz", + "integrity": "sha512-GytjJUzacHhe3C24HFrPl881Donrw2m+3JBNqMJALxMRjSA8yY72+l16bZR9YFsrywSHVSbjxIfzqtGb8rIVJg==", "requires": { + "@react-navigation/elements": "^1.1.0", "color": "^3.1.3", - "react-native-iphone-x-helper": "^1.3.0" + "warn-once": "^0.1.0" } }, "@react-navigation/core": { - "version": "5.16.0", - "resolved": "https://registry.npmjs.org/@react-navigation/core/-/core-5.16.0.tgz", - "integrity": "sha512-dy/sfO2Tl41r3vB2uUXTh6d9HY7Q2i43CxfqsU4fnGw5QRmp+7LaMidhGYOoH1wJ50IMWoBC2TdAr0x+5iluHg==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/@react-navigation/core/-/core-6.0.1.tgz", + "integrity": "sha512-mVdvBDYdz8uzLQHokmVdX/xC4rS7NIkD1FN/yaGdovVzYApAhM+UGd3w1zskjyCSyXaVHHOwV59ZGVew+84xfQ==", "requires": { - "@react-navigation/routers": "^5.7.4", + "@react-navigation/routers": "^6.0.1", "escape-string-regexp": "^4.0.0", - "nanoid": "^3.1.15", - "query-string": "^6.13.6", + "nanoid": "^3.1.23", + "query-string": "^7.0.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": { - "version": "5.8.10", - "resolved": "https://registry.npmjs.org/@react-navigation/native/-/native-5.8.10.tgz", - "integrity": "sha512-OUgD1o+y7PwmhRIRqQxN0SQvVU/SHic/ek/qMvBZX8nu5/WlBNxmNRMHVxONgHlG3AQZh27NUs9ynntL7ek1zQ==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/@react-navigation/native/-/native-6.0.2.tgz", + "integrity": "sha512-HDqEwgvQ4Cu16vz8jQ55lfyNK9CGbECI1wM9cPOcUa+gkOQEDZ/95VFfFjGGflXZs3ybPvGXlMC4ZAyh1CcO6w==", "requires": { - "@react-navigation/core": "^5.14.4", + "@react-navigation/core": "^6.0.1", "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": { - "version": "5.7.4", - "resolved": "https://registry.npmjs.org/@react-navigation/routers/-/routers-5.7.4.tgz", - "integrity": "sha512-0N202XAqsU/FlE53Nmh6GHyMtGm7g6TeC93mrFAFJOqGRKznT0/ail+cYlU6tNcPA9AHzZu1Modw1eoDINSliQ==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/@react-navigation/routers/-/routers-6.0.1.tgz", + "integrity": "sha512-5ctB49rmtTRQuTSBVgqMsEzBUjPP2ByUzBjNivA7jmvk+PDCl4oZsiR8KAm/twhxe215GYThfi2vUWXKAg6EEQ==", "requires": { - "nanoid": "^3.1.15" + "nanoid": "^3.1.23" } }, "@react-navigation/stack": { - "version": "5.12.8", - "resolved": "https://registry.npmjs.org/@react-navigation/stack/-/stack-5.12.8.tgz", - "integrity": "sha512-wUJFbU0v606RBXOUxHToCXJNmiwxtFYhN2TFvjxCZ3PJU+OWWx8HTmn99pT3rVH4Ax2cfO5BDUy9v+r74ZrIWw==", + "version": "6.0.7", + "resolved": "https://registry.npmjs.org/@react-navigation/stack/-/stack-6.0.7.tgz", + "integrity": "sha512-hxwhRZbn6zD2rInhItBeHTCPYzmurz+/8/MhtRevBEdLG0+61dik8Y+evg/mu6AsOU0WrDakTsLcHdf/9zkXzw==", "requires": { + "@react-navigation/elements": "^1.1.0", "color": "^3.1.3", - "react-native-iphone-x-helper": "^1.3.0" + "warn-once": "^0.1.0" } }, "@sinonjs/commons": { @@ -3831,9 +3842,9 @@ } }, "@types/node": { - "version": "16.6.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.6.1.tgz", - "integrity": "sha512-Sr7BhXEAer9xyGuCN3Ek9eg9xPviCF2gfu9kTfuU2HkTVAMYSDeX40fvpmo72n5nansg3nsBjuQBrsS28r+NUw==" + "version": "16.7.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.7.1.tgz", + "integrity": "sha512-ncRdc45SoYJ2H4eWU9ReDfp3vtFqDYhjOsKlFFUDEn8V1Bgr2RjYal8YT5byfadWIRluhPFU6JiDOl0H6Sl87A==" }, "@types/normalize-package-data": { "version": "2.4.1", @@ -4692,15 +4703,15 @@ } }, "browserslist": { - "version": "4.16.7", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.16.7.tgz", - "integrity": "sha512-7I4qVwqZltJ7j37wObBe3SoTz+nS8APaNcrBOlgoirb6/HbEU2XxW/LpUDTCngM6iauwFqmRTuOMfyKnFGY5JA==", + "version": "4.16.8", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.16.8.tgz", + "integrity": "sha512-sc2m9ohR/49sWEbPj14ZSSZqp+kbi16aLao42Hmn3Z8FpjuMaq2xCA2l4zl9ITfyzvnvyE0hcg62YkIGKxgaNQ==", "requires": { - "caniuse-lite": "^1.0.30001248", - "colorette": "^1.2.2", - "electron-to-chromium": "^1.3.793", + "caniuse-lite": "^1.0.30001251", + "colorette": "^1.3.0", + "electron-to-chromium": "^1.3.811", "escalade": "^3.1.1", - "node-releases": "^1.1.73" + "node-releases": "^1.1.75" } }, "bser": { @@ -5162,9 +5173,9 @@ "integrity": "sha1-ZSKUwUZR2yj6k70tX/KYOk8IxjY=" }, "core-js-compat": { - "version": "3.16.1", - "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.16.1.tgz", - "integrity": "sha512-NHXQXvRbd4nxp9TEmooTJLUf94ySUG6+DSsscBpTftN1lQLQ4LjnWvc7AoIo4UjDsFF3hB8Uh5LLCRRdaiT5MQ==", + "version": "3.16.2", + "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.16.2.tgz", + "integrity": "sha512-4lUshXtBXsdmp8cDWh6KKiHUg40AjiuPD3bOWkNVsr1xkAhpUqCjaZ8lB1bKx9Gb5fXcbRbFJ4f4qpRIRTuJqQ==", "requires": { "browserslist": "^4.16.7", "semver": "7.0.0" @@ -5458,9 +5469,9 @@ "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" }, "electron-to-chromium": { - "version": "1.3.806", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.806.tgz", - "integrity": "sha512-AH/otJLAAecgyrYp0XK1DPiGVWcOgwPeJBOLeuFQ5l//vhQhwC9u6d+GijClqJAmsHG4XDue81ndSQPohUu0xA==" + "version": "1.3.814", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.814.tgz", + "integrity": "sha512-0mH03cyjh6OzMlmjauGg0TLd87ErIJqWiYxMcOLKf5w6p0YEOl7DJAj7BDlXEFmCguY5CQaKVOiMjAMODO2XDw==" }, "emoji-regex": { "version": "8.0.0", @@ -6291,9 +6302,9 @@ "dev": true }, "fastq": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.11.1.tgz", - "integrity": "sha512-HOnr8Mc60eNYl1gzwp6r5RoUyAn5/glBolUzP/Ez6IFVPMPirxn/9phgL6zhOtaTy7ISwPvQ+wT+hfcRZh/bzw==", + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.12.0.tgz", + "integrity": "sha512-VNX0QkHK3RsXVKr9KrlUv/FoTa0NdbYoHHl7uXHv2rzyHSlxjdNAKug2twd9luJxpcyNeAgf5iPPMutJO67Dfg==", "requires": { "reusify": "^1.0.4" } @@ -7073,9 +7084,9 @@ } }, "is-core-module": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.5.0.tgz", - "integrity": "sha512-TXCMSDsEHMEEZ6eCA8rwRDbLu55MRGmrctljsBX/2v1d9/GzqHOxW5c5oPSgrUt2vBFXebu9rGqckXGPWOlYpg==", + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.6.0.tgz", + "integrity": "sha512-wShG8vs60jKfPWpF2KZRaAtvt3a20OAn7+IJ6hLPECpSABLcKtFKTTI4ZtH5QcBruBHlq+WsdHWyz0BCZW7svQ==", "requires": { "has": "^1.0.3" } @@ -12217,9 +12228,9 @@ } }, "node-releases": { - "version": "1.1.74", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.74.tgz", - "integrity": "sha512-caJBVempXZPepZoZAPCWRTNxYQ+xtG/KAi4ozTA5A+nJ7IU+kLQCbqaUjb5Rwy14M9upBWiQ4NutcmW04LJSRw==" + "version": "1.1.75", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.75.tgz", + "integrity": "sha512-Qe5OUajvqrqDSy6wrWFmMwfJ0jVgwiw4T3KqmbTcZ62qW0gQkheXYhcFM1+lOVcGUoRxcEcfyvFMAnDgaF1VWw==" }, "node-stream-zip": { "version": "1.14.0", @@ -12970,9 +12981,9 @@ } }, "query-string": { - "version": "6.14.1", - "resolved": "https://registry.npmjs.org/query-string/-/query-string-6.14.1.tgz", - "integrity": "sha512-XDxAeVmpfu1/6IjyT/gXHOl+S0vQ9owggJ30hhWKdHAsNPOcasn5o9BW0eejZqL2e4vMjhAxoW3jVHcD6mbcYw==", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/query-string/-/query-string-7.0.1.tgz", + "integrity": "sha512-uIw3iRvHnk9to1blJCG3BTc+Ro56CBowJXKmNNAm3RulvPBzWLRqKSiiDk+IplJhsydwtuNMHi8UGQFcCLVfkA==", "requires": { "decode-uri-component": "^0.2.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": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/react-native-reanimated/-/react-native-reanimated-2.2.0.tgz", diff --git a/Ejectable/package.json b/Ejectable/package.json index 7e7e85f3..45d2359c 100644 --- a/Ejectable/package.json +++ b/Ejectable/package.json @@ -13,10 +13,10 @@ }, "dependencies": { "@expo/vector-icons": "^12.0.0", - "@react-native-community/masked-view": "0.1.10", - "@react-navigation/bottom-tabs": "5.11.2", - "@react-navigation/native": "~5.8.10", - "@react-navigation/stack": "~5.12.8", + "@react-navigation/bottom-tabs": "^6.0.5", + "@react-navigation/native": "^6.0.2", + "@react-navigation/native-stack": "^6.1.0", + "@react-navigation/stack": "^6.0.7", "expo": "~42.0.1", "expo-asset": "~8.3.2", "expo-constants": "~11.0.1", diff --git a/Ejectable/screens/NotFoundScreen.tsx b/Ejectable/screens/NotFoundScreen.tsx index 31d196a1..bf75687e 100644 --- a/Ejectable/screens/NotFoundScreen.tsx +++ b/Ejectable/screens/NotFoundScreen.tsx @@ -1,12 +1,9 @@ -import { StackScreenProps } from '@react-navigation/stack'; import * as React from 'react'; import { StyleSheet, Text, TouchableOpacity, View } from 'react-native'; -import { RootStackParamList } from '../types'; +import { RootStackScreenProps } from '../types'; -export default function NotFoundScreen({ - navigation, -}: StackScreenProps) { +export default function NotFoundScreen({ navigation }: RootStackScreenProps<'NotFound'>) { return ( This screen doesn't exist. diff --git a/Ejectable/screens/SettingsScreen.tsx b/Ejectable/screens/SettingsScreen.tsx index 6c4b6329..2b8d4854 100644 --- a/Ejectable/screens/SettingsScreen.tsx +++ b/Ejectable/screens/SettingsScreen.tsx @@ -42,7 +42,7 @@ export default function SettingsScreen() { returnKeyType={'done'} onChangeText={onChangeNumber} value={number} - placeholder="0.67" + placeholder="250" keyboardType="numeric" /> diff --git a/Ejectable/screens/TripScreen.tsx b/Ejectable/screens/TripScreen.tsx index 97e463b8..f9aed419 100644 --- a/Ejectable/screens/TripScreen.tsx +++ b/Ejectable/screens/TripScreen.tsx @@ -2,7 +2,7 @@ import * as React from 'react'; import { Button, StyleSheet, Alert } from 'react-native'; import { Text, View } from '../components/Themed'; import { ScreenInfo2 } from '../components/ScreenInfo'; -import { GT2, thisTrip } from '../GT2'; +import { ThisTrip } from '../GT2'; const styles = StyleSheet.create({ container: { @@ -29,21 +29,21 @@ const styles = StyleSheet.create({ function startTrip() { - thisTrip.start(); + ThisTrip.start(); Alert.alert('Trip Started'); } function pauseTrip() { - thisTrip.pause(); + ThisTrip.pause(); Alert.alert('Trip Paused'); } function endTrip() { - thisTrip.end(); + ThisTrip.end(); Alert.alert('Trip Ended'); } @@ -69,7 +69,7 @@ export default function TripScreen() { onPress={() => endTrip() } /> - < thisTrip.TripDisplay /> + < ThisTrip.tripDisplay /> ); diff --git a/Ejectable/tsconfig.json b/Ejectable/tsconfig.json index 92451b4d..b98a13ee 100644 --- a/Ejectable/tsconfig.json +++ b/Ejectable/tsconfig.json @@ -1,6 +1,6 @@ -{ - "extends": "expo/tsconfig.base", +{ + "extends": "expo/tsconfig.base", "compilerOptions": { "strict": true } -} +} diff --git a/Ejectable/types.tsx b/Ejectable/types.tsx index 7aab0f62..b01b3ece 100644 --- a/Ejectable/types.tsx +++ b/Ejectable/types.tsx @@ -3,25 +3,34 @@ * 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 = { - Root: undefined; + Root: NavigatorScreenParams | undefined; + Modal: undefined; NotFound: undefined; }; -export type BottomTabParamList = { +export type RootStackScreenProps = NativeStackScreenProps< + RootStackParamList, + Screen +>; + +export type RootTabParamList = { Home: undefined; - Trip: undefined; Settings: undefined; + Trip: undefined; }; -export type TripParamList = { - TripScreen: undefined; -}; - -export type SettingsParamList = { - SettingsScreen: undefined; -}; - -export type HomeParamList = { - HomeScreen: undefined; -}; +export type RootTabScreenProps = CompositeScreenProps< + BottomTabScreenProps, + NativeStackScreenProps +>;