Skip to content

Commit 88504ff

Browse files
committed
Add version info to the home page
1 parent c0fc387 commit 88504ff

File tree

2 files changed

+43
-17
lines changed

2 files changed

+43
-17
lines changed

game/app/index.tsx

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,31 @@ import { Pressable, StyleSheet } from "react-native";
22

33
import GradientBackgroundView from "@/components/GradientBackgroundView";
44
import { ThemedText } from "@/components/ThemedText";
5+
import { VersionInfo } from "@/components/VersionInfo";
56
import { Link } from "expo-router";
67

78
export default function Index() {
89
return (
9-
<GradientBackgroundView style={styles.container}>
10-
<Link href="/1" asChild>
11-
<Pressable>
12-
<ThemedText>Classic</ThemedText>
13-
</Pressable>
14-
</Link>
15-
<Link href="/2" asChild>
16-
<Pressable>
17-
<ThemedText>Duo</ThemedText>
18-
</Pressable>
19-
</Link>
20-
<Link href="/4" asChild>
21-
<Pressable>
22-
<ThemedText>Quad</ThemedText>
23-
</Pressable>
24-
</Link>
25-
</GradientBackgroundView>
10+
<>
11+
<GradientBackgroundView style={styles.container}>
12+
<Link href="/1" asChild>
13+
<Pressable>
14+
<ThemedText>Classic</ThemedText>
15+
</Pressable>
16+
</Link>
17+
<Link href="/2" asChild>
18+
<Pressable>
19+
<ThemedText>Duo</ThemedText>
20+
</Pressable>
21+
</Link>
22+
<Link href="/4" asChild>
23+
<Pressable>
24+
<ThemedText>Quad</ThemedText>
25+
</Pressable>
26+
</Link>
27+
</GradientBackgroundView>
28+
<VersionInfo />
29+
</>
2630
);
2731
}
2832

game/components/VersionInfo.tsx

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { StyleSheet, View } from "react-native";
2+
3+
import Constants from "expo-constants";
4+
import { ThemedText } from "./ThemedText";
5+
6+
export function VersionInfo() {
7+
const version = Constants.expoConfig?.version;
8+
9+
return version ? (
10+
<View>
11+
<ThemedText style={styles.versionInfo}>{`v${version}`}</ThemedText>
12+
</View>
13+
) : null;
14+
}
15+
16+
const styles = StyleSheet.create({
17+
versionInfo: {
18+
position: "absolute",
19+
bottom: 4,
20+
right: 4,
21+
},
22+
});

0 commit comments

Comments
 (0)