Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/game/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export default function GamePage() {
animationDuration: 0,
animationTypeForReplace: "push",
animation: "flip",
gestureEnabled: false,
}}
/>
<Suspense fallback={<ActivityIndicator />}>
Expand Down
1 change: 1 addition & 0 deletions app/game/post-match.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export default function PostMatch() {
animationDuration: 0,
animationTypeForReplace: "push",
animation: "flip",
gestureEnabled: false,
}}
/>
<NavBar title="Post match" />
Expand Down
10 changes: 9 additions & 1 deletion app/game/submit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
} from "../../lib/models/match";
import { Suspense, useEffect, useState } from "react";
import { ScoutReport } from "../../lib/collection/ScoutReport";
import { router } from "expo-router";
import { router, Stack } from "expo-router";
import { uploadReport } from "../../lib/lovatAPI/uploadReport";
import { Icon } from "../../lib/components/Icon";
import { useHistoryStore } from "../../lib/storage/historyStore";
Expand Down Expand Up @@ -72,6 +72,14 @@ export default function Submit() {

return (
<>
<Stack.Screen
options={{
animationDuration: 0,
animationTypeForReplace: "push",
animation: "flip",
gestureEnabled: false,
}}
/>
<NavBar
title={`${reportState.meta!.teamNumber} in ${localizeMatchIdentity(reportState.meta!.matchIdentity, MatchIdentityLocalizationFormat.Short)}`}
/>
Expand Down
2 changes: 1 addition & 1 deletion app/home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export default function Home() {
useEffect(() => {
if (!reportState.meta) return;

router.replace("/game");
router.push("/game");
}, [reportState.meta]);

return (
Expand Down
27 changes: 22 additions & 5 deletions lib/collection/ui/Game.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,28 @@ export function Game() {
gamePhaseMessage: "Pre-Match",
field: <PreMatchActions />,
topLeftReplacement: (
<Checkbox
label="Loaded with a coral"
checked={reportState?.startPiece}
onChange={reportState.setStartPiece}
/>
<View style={{ flexDirection: "row", alignItems: "center", gap: 8 }}>
{router.canGoBack() && (
<TouchableOpacity
onPress={() => {
reportState.reset();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't run on all methods the user could use to go back. There might be accessibility gestures or something, or at least on web (which I know we don't use) you can press the back button in the browser.

I'd recommend using a 'beforeRemove' event to handle all cases.

router.back();
}}
style={{ padding: 8 }}
>
<Icon
name="arrow_back_ios"
size={24}
color={colors.onBackground.default}
/>
</TouchableOpacity>
)}
<Checkbox
label="Loaded with a coral"
checked={reportState?.startPiece}
onChange={reportState.setStartPiece}
/>
</View>
),
startEnabled: reportState.startPosition !== undefined,
},
Expand Down
Loading