Basic routing implementation.
This commit is contained in:
20
app/jobs/[jobId].tsx
Normal file
20
app/jobs/[jobId].tsx
Normal 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
18
app/jobs/_layout.tsx
Normal 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
24
app/jobs/index.tsx
Normal 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",
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user