From Expo Router to Detour: Deferred deep linking the right way
Key Points
- Pre-route deferred links via +native-intent
- Auth-safe single-shot link replay with DetourProvider
- Android uses Install Referrer; iOS uses probabilistic matching
Summary
This post introduces Detour, a deferred deep-linking solution built to integrate with Expo Router and solve the "Installation Gap": web link context lost when users pass through the App Store / Play Store. Detour resolves the original URL before the first screen renders (via Expo Router's +native-intent extension) and holds the intent until your app is ready to navigate (avoiding auth-gate races and duplicate navigations).
Key Points
- Pre-routing integration: Detour hooks into
+native-intent.tsxusingcreateDetourNativeIntentHandler(...)so the router receives the resolved link before any screen mounts — eliminating post-mount race conditions. - Auth-safe replay: Wrap your app in
DetourProviderand useuseDetourContext()(fields:link,isLinkProcessed,clearLink) to replay the saved route once auth is satisfied; callrouter.replace(link.route)andclearLink()to ensure a single navigation. - Platform matching:
- Android: deterministic 1:1 matching via Install Referrer (click_id) for 100% accurate referral recovery.
- iOS: probabilistic matching using non-identifying signal snapshots (privacy-constrained).
- Developer ergonomics: by operating at the router level Detour avoids fragile glue code, duplicate listeners, and timing bugs common when using attribution SDKs outside the navigation system.
- Multi-platform and roadmap: Detour 1.0 supports custom domains and SDKs for React Native, Flutter, and native; the team plans to expand features while keeping the tool developer-first.
Practical next steps for engineers
- Add a
+native-intent.tsxhandler that callscreateDetourNativeIntentHandlerto enable pre-routing resolution. - Wrap your root layout with
DetourProviderand useuseDetourContext()to defer navigation until auth gates pass. - Test both Android (install referrer flow) and iOS (probabilistic matching) to validate recovery rates.
If you need help or want to request features, open an issue on GitHub or join Detour's Discord.