Overview
TheExternalLink component wraps Expo Router’s Link component to provide a better user experience when opening external URLs. On native platforms (iOS/Android), it opens links in an in-app browser using expo-web-browser, keeping users within your app. On web, it behaves like a standard external link.
Import
Props
Extends all props from Expo Router’sLink component, except href is required and must be a string URL.
The URL to open. Must be a valid external URL (e.g.,
https://example.com).The content to render inside the link (typically text or an icon).
All other props from Expo Router’s Link component are supported.
Usage
Basic External Link
src/app/(tabs)/explore.tsx:
Platform Behavior
iOS and Android
On native platforms, the component:- Prevents the default browser opening behavior
- Opens the URL in an in-app browser using
expo-web-browser - Uses
WebBrowserPresentationStyle.AUTOMATICfor a native feel - Keeps users within your app context
Web
On web, the component:- Opens the link in a new tab (via
target="_blank") - Behaves like a standard HTML anchor tag
Implementation Details
The component uses theEXPO_OS environment variable to detect the platform and conditionally applies the in-app browser behavior:
Related
- Link (Expo Router) - Base Link component
- expo-web-browser - In-app browser API