Skip to the page

Navigation and deep linking · mid

Deep linking: cold start, warm start and notification taps

A deep link must work whether the app is killed (Linking.getInitialURL), in the background or open (the "url" event); React Navigation's linking config maps the URL path to nested screens for you, as long as you also wait for navigation and auth to be ready.

The notes

What you must know

  • Cold start: Linking.getInitialURL() returns the launch URL (or null). Warm: Linking.addEventListener("url", …). React Navigation's linking prop (prefixes + config) handles both.
  • The config maps paths to screens, including nested navigators: { screens: { Home: { screens: { Order: "order/:id" } } } }.
  • Auth gate: if the user is signed out, keep the pending URL, show login, then open it after login (or let the conditional tree handle it).
  • From outside React (notifications, SDK callbacks), wait for navigationRef.isReady() before navigating.
  • Notification taps: turn the payload into a URL and reuse the same linking config, so there is one routing path. Validate payloads and handle deleted items (404) gracefully.
  • Custom schemes (myapp://) can be claimed by any app: never put tokens in deep links. Prefer universal links / App Links for anything sensitive.
  • iOS SceneDelegate (RN 0.88, needed for the iOS 27 SDK): forward the scene's URL and user-activity callbacks to RCTLinkingManager and pass connectionOptions, or getInitialURL() returns null.
  • Test with npx uri-scheme open myapp://order/1 --ios, or adb shell am start -W -a android.intent.action.VIEW -d "myapp://order/1".

The red pen

Common traps: mistake → fix

  • Mistake: "Handle only the url event"

    Fix: that misses the cold start.

  • Mistake: "Navigate as soon as the app launches"

    Fix: the navigation container may not be ready yet.

  • Mistake: "new URL('myapp://order/123').pathname is /order/123"

    Fix: for a custom scheme "order" is parsed as the host; the pathname is /123.

Easy to hard

Questions interviewers ask, easy to hard

  1. Make myapp://order/123 open the order screen when the app is killed, backgrounded or open.
  2. What happens if the user is not logged in?
  3. Route a push-notification tap to Order 123 inside the Orders tab from a killed state.
  4. What native setup is needed on iOS and Android? What changes with SceneDelegate?

Practise

Practise with these questions

Your first interview is free

Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.

Start your free interview