Basic routing implementation.

This commit is contained in:
Patrick Fic
2025-10-07 15:35:03 -07:00
parent befa06a6b5
commit b8261f001e
14 changed files with 127 additions and 308 deletions

20
app/jobs/[jobId].tsx Normal file
View File

@@ -0,0 +1,20 @@
import { useLocalSearchParams } from "expo-router";
import { StyleSheet, Text, View } from "react-native";
export default function JobDetail() {
const params = useLocalSearchParams();
return (
<View style={styles.container}>
<Text>Job Details for Job ID: {JSON.stringify(params)}</Text>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: "center",
alignItems: "center",
},
});

18
app/jobs/_layout.tsx Normal file
View File

@@ -0,0 +1,18 @@
import { Stack } from "expo-router";
function JobsStack() {
return (
<Stack
screenOptions={{
headerTitleStyle: {
fontWeight: "bold",
},
}}
>
<Stack.Screen name="index" options={{ title: "Active Jobs" }} />
<Stack.Screen name="[jobId]" options={{ title: "Job Details" }} />
</Stack>
);
}
export default JobsStack;

24
app/jobs/index.tsx Normal file
View File

@@ -0,0 +1,24 @@
import { Link } from "expo-router";
import { StyleSheet, Text, View } from "react-native";
export default function Tab() {
return (
<View style={styles.container}>
<Text>Jobs Screen.</Text>
<Link
href={{ pathname: "/jobs/[jobId]", params: { jobId: 123 } }}
withAnchor
>
Go to detail
</Link>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: "center",
alignItems: "center",
},
});