You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* refactor: rename API_KEY to apiKey
* refactor: update detour context type and usage
* refactor: improve examples and clean up types
* docs: improve deep link testing instructions and logic
* refactor: simplify type annotation in useDetour hook
@@ -143,7 +143,7 @@ If you want to know more details about a given example and how to configure it,
143
143
144
144
## Clearing handled links
145
145
146
-
If your app redirects based on `linkRoute` (especially in entry screens), call `clearLink()` after handling the route. This prevents repeated redirects when the user returns to the same screen.
146
+
If your app redirects based on `link` (especially in entry screens), call `clearLink()` after handling the route. This prevents repeated redirects when the user returns to the same screen.
147
147
148
148
## Types
149
149
@@ -191,7 +191,7 @@ export type Config = {
191
191
192
192
### DetourContextType
193
193
194
-
This type represents the object returned by the useDetourContext hook, containing the deferred link and its processing status.
194
+
This type represents the object returned by the `useDetourContext` hook, containing the resolved link and its processing status.
195
195
196
196
```js
197
197
exporttypeDetourContextType= {
@@ -202,27 +202,43 @@ export type DetourContextType = {
202
202
isLinkProcessed: boolean;
203
203
204
204
/**
205
-
* The raw link URL (string or URL object), or null if no link was found.
205
+
* The resolved link object, or null if no link was found.
206
206
*/
207
-
linkUrl: string | URL | null;
207
+
link: DetourLink;
208
208
209
209
/**
210
-
* The parsed route path derived from the link (e.g. '/details/42'), or null if no link was found.
210
+
* Resets the link to null. Call this after you handle a link.
211
211
*/
212
-
linkRoute: string | null;
212
+
clearLink: () => void;
213
+
};
214
+
```
213
215
214
-
/**
215
-
* The type of the detected link: 'deferred', 'verified' (Universal/App link), or 'scheme'.
216
-
* 'scheme' is only emitted when linkProcessingMode is 'all' (default).
217
-
* Null if no link was found.
218
-
*/
219
-
linkType: LinkType | null;
216
+
### DetourLink
217
+
218
+
The resolved link object, or null if no link was found.
219
+
220
+
```js
221
+
exporttypeDetourLink= {
222
+
/** The original link URL as received by the SDK. */
223
+
url: string | URL;
224
+
225
+
/** Full route path including query string (e.g. '/details/42?campaign=summer'). */
226
+
route: string;
227
+
228
+
/** Route path without query string (e.g. '/details/42'). */
Copy file name to clipboardExpand all lines: examples/expo-bare/README.md
+4-3Lines changed: 4 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,6 +33,7 @@ If you need more complex routing flows with a specific navigation library, check
33
33
- Install dependencies: `yarn install`
34
34
- Configure this app in Detour Dashboard: `https://godetour.dev` using identifiers from `app.json` (for example `ios.bundleIdentifier`, `android.package`).
35
35
- Use values from Dashboard from "API configuration" section to fill `.env` and update `app.json` with generated integration code.
36
-
- Run prebuild for this example: `cd examples/expo-bare && npx expo prebuild`
37
-
- Start the example from repo root: `yarn examples:expo-bare start`
38
-
- Run on device/simulator: `yarn workspace @swmansion/react-native-detour-expo-bare ios` or `yarn workspace @swmansion/react-native-detour-expo-bare android`
36
+
- Run prebuild for this example: `yarn prebuild`
37
+
- Start the example: `yarn start`
38
+
- Run on device/simulator: `yarn ios` or `yarn android`
39
+
- Trigger test links: **deferred** — copy the link from Detour Dashboard before a fresh install, then install and launch (link resolves on first open). **Universal/App link** — open the link from Dashboard while the app is running. See **Test flow** for more detail.
Copy file name to clipboardExpand all lines: examples/expo-router-advanced/README.md
+4-3Lines changed: 4 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,6 +40,7 @@ Optional custom scheme test:
40
40
- Install dependencies: `yarn install`
41
41
- Configure this app in Detour Dashboard: `https://godetour.dev` using identifiers from `app.json` (for example `ios.bundleIdentifier`, `android.package`).
42
42
- Use values from Dashboard from "API configuration" section to fill `.env` and update `app.json` with generated integration code.
43
-
- Run prebuild for this example: `cd examples/expo-router-advanced && npx expo prebuild`
44
-
- Start the example from repo root: `yarn examples:expo-router-advanced start`
45
-
- Run on device/simulator: `yarn workspace @swmansion/react-native-detour-expo-router-advanced ios` or `yarn workspace @swmansion/react-native-detour-expo-router-advanced android`
43
+
- Run prebuild for this example: `yarn prebuild`
44
+
- Start the example: `yarn start`
45
+
- Run on device/simulator: `yarn ios` or `yarn android`
46
+
- Trigger test links: **deferred** — copy the link from Detour Dashboard before a fresh install, then install and launch (link resolves on first open). **Universal/App link** — open the link from Dashboard while the app is running. **Custom scheme** — open `detour-expo-router-advanced://app/anything` directly. See **Test flow** for more detail.
// This component acts as a gate for incoming Detour links, coordinating with the auth state and routing logic of the app.
12
12
// It should be placed inside the DetourProvider and rendered on all screens (e.g. in the root layout) to ensure that incoming links are handled correctly regardless of the current screen.
0 commit comments