-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathHome.tsx
More file actions
69 lines (60 loc) · 2.78 KB
/
Copy pathHome.tsx
File metadata and controls
69 lines (60 loc) · 2.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import { Pressable, ScrollView, Text, View } from "react-native";
import { useNavigation } from "@react-navigation/native";
import type { NativeStackNavigationProp } from "@react-navigation/native-stack";
import { useAuth } from "../../auth";
import { colors, styles } from "../../styles";
import type { RootStackParamList } from "../index";
export function Home() {
const navigation = useNavigation<NativeStackNavigationProp<RootStackParamList>>();
const { signOut } = useAuth();
return (
<View style={{ flex: 1, backgroundColor: colors.background }}>
<ScrollView contentContainerStyle={styles.scrollContent}>
<View style={styles.card}>
<Text style={styles.title}>Detour Example</Text>
<Text style={styles.subtitle}>
Add credentials from the Detour panel to <Text style={styles.accent}>.env</Text> before
testing.
</Text>
<View style={styles.divider} />
<Text style={styles.sectionHeader}>Universal / App Link</Text>
<Text style={styles.bullet}>
Open a <Text style={styles.accent}>godetour.link</Text> URL in the browser — Detour
resolves it and navigates to the Details screen.
</Text>
<Text style={styles.code}>
https://<your-org>.godetour.link/<hash>/details
</Text>
<Text style={styles.sectionHeader}>Custom Scheme</Text>
<Text style={styles.bullet}>
This example also handles custom scheme links. Opening a non-Detour URL redirects to the
Third-party screen. Test with the simulator:
</Text>
<Text style={styles.code}>
npx uri-scheme open {`"detour-react-navigation-advanced://app"`} --ios
</Text>
<Text style={styles.sectionHeader}>Deferred Link + Auth Gate</Text>
<Text style={styles.bullet}>
Copy a Detour link, sign out, then relaunch. The link survives the sign-in flow — you'll
land on the Details screen once you complete sign-in and onboarding.
</Text>
<Text style={styles.bullet}>
Make sure <Text style={styles.accent}>Copy link feature enabled</Text> is turned on in
App Configuration in the Detour panel.
</Text>
</View>
</ScrollView>
<View style={{ flexDirection: "row", gap: 12, padding: 16 }}>
<Pressable
onPress={() => navigation.navigate("Details")}
style={[styles.button, { flex: 1 }]}
>
<Text style={styles.buttonText}>Go to Details →</Text>
</Pressable>
<Pressable onPress={signOut} style={[styles.button, styles.dangerButton, { flex: 1 }]}>
<Text style={styles.buttonText}>Logout</Text>
</Pressable>
</View>
</View>
);
}