diff --git a/Ejectable/GT2.tsx b/Ejectable/GT2.tsx index b4fd2cdd..ccdef6ab 100644 --- a/Ejectable/GT2.tsx +++ b/Ejectable/GT2.tsx @@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react'; import * as Location from 'expo-location'; import { Coordinate } from "./Coordinate"; import { Text, View } from './components/Themed'; -import { Button, StyleSheet } from 'react-native'; +import { StyleSheet } from 'react-native'; var debug:boolean = false; export var endPending:boolean = false; @@ -12,8 +12,8 @@ export var locEnabled:boolean = false; const heartbeat:number = 500; const displayBeat:number = 3; -export function getEndPending() { return(endPending) } -export function toggleEndPending() { endPending = !endPending;} +export function getEndPending() { return(endPending); } +export function setEndPending(value:boolean) { endPending = value; } const styles = StyleSheet.create({ tripText: { @@ -149,7 +149,7 @@ export class GT2 { this.trip.stop(); this.inProgress = false; this.nTrips++; - toggleEndPending(); + setEndPending(true); } @@ -265,10 +265,10 @@ export class TripDisplay extends React.Component { export class TripSummary extends React.Component { - constructor(props:any) { - super(props); - this.state = { slug: null }; - } + handleRefresh = () => { + // by calling this method react re-renders the component + this.setState({}); + }; render() { diff --git a/Ejectable/navigation/index.tsx b/Ejectable/navigation/index.tsx index 7364d4d3..4b3a5c49 100644 --- a/Ejectable/navigation/index.tsx +++ b/Ejectable/navigation/index.tsx @@ -42,7 +42,7 @@ function RootNavigator() { - + ); diff --git a/Ejectable/screens/HomeScreen.tsx b/Ejectable/screens/HomeScreen.tsx index 90a74e2c..33a1f443 100644 --- a/Ejectable/screens/HomeScreen.tsx +++ b/Ejectable/screens/HomeScreen.tsx @@ -2,12 +2,13 @@ import * as React from 'react'; import { StyleSheet, ImageBackground } from 'react-native'; import { Text, View } from '../components/Themed'; import { ScreenInfo3 } from '../components/ScreenInfo'; +import { RootTabScreenProps } from '../types'; const image = { uri: "https://meansofproduction.biz/images/GREENT.jpg" }; export var nav:any = null; -export default function HomeScreen(navigation:any) { +export default function HomeScreen( { navigation }: RootTabScreenProps<'Home'>) { nav = navigation; return ( diff --git a/Ejectable/screens/ModalScreen.tsx b/Ejectable/screens/ModalScreen.tsx index c8f79c55..921617cb 100644 --- a/Ejectable/screens/ModalScreen.tsx +++ b/Ejectable/screens/ModalScreen.tsx @@ -1,17 +1,20 @@ import { StatusBar } from 'expo-status-bar'; import * as React from 'react'; -import { Platform, StyleSheet } from 'react-native'; +import { Button, Platform, StyleSheet } from 'react-native'; import EndScreenInfo from '../components/EndScreenInfo'; import { Text, View } from '../components/Themed'; +import { RootTabScreenProps } from '../types'; -export default function ModalScreen() { +export default function ModalScreen({ navigation }: RootTabScreenProps<'Settings'>) { return ( - Modal + Carbon Impact - +