📱 React Native Intermediate

What is Deep Linking in React Native?

Answer

Deep linking allows external URLs to open specific screens in your app — like clicking a link in an email and having the app open to the relevant screen. Two types: Custom URL Schemes (myapp://screen/id): your app registers a custom protocol. Works on any device but shows an alert on iOS if app not installed. Easier to implement. Universal Links (iOS) / App Links (Android) (https://yourdomain.com/...): uses real HTTPS URLs. If app is installed, opens the app; if not, opens the browser. Seamless UX, requires server-side configuration (apple-app-site-association file / assetlinks.json). Configuration for custom scheme: iOS Info.plist: <key>CFBundleURLTypes</key> <array><dict> <key>CFBundleURLSchemes</key> <array><string>myapp</string></array> </dict></array>. Android AndroidManifest.xml: <intent-filter> <action android:name="android.intent.action.VIEW" /> <data android:scheme="myapp" /> </intent-filter>. React Navigation deep linking config: const linking = { prefixes: ["myapp://", "https://myapp.com"], config: { screens: { Home: "", Profile: "user/:id", Settings: "settings" } } }; <NavigationContainer linking={linking}>. Expo Router: deep linking is automatic — URL structure matches file structure. Universal links require Expo config and server file. Testing: npx uri-scheme open myapp://user/123 --ios or adb shell am start -W -a android.intent.action.VIEW -d "myapp://user/123".