Create and open deep links universally across React Native, Expo, and web platforms
—
Pending
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Pending
The risk profile of this skill
Essential URL operations for opening URLs, checking URL support, retrieving initial URLs, and Android-specific intent launching.
Opens a URL with an installed app or system browser.
/**
* Attempt to open the given URL with an installed app.
* @param url - A URL for the operating system to open (e.g. 'tel:5555555', 'exp://', 'https://example.com')
* @returns Promise that resolves with true if link is opened, rejects if no app handles URL or user cancels
*/
function openURL(url: string): Promise<true>;Usage Example:
import { openURL } from "expo-linking";
try {
await openURL("https://expo.dev");
console.log("URL opened successfully");
} catch (error) {
console.log("Failed to open URL:", error);
// Error cases:
// - No app can handle the URL scheme
// - User canceled the open dialog
// - Malformed URL
}
// Open phone dialer
await openURL("tel:+1234567890");
// Open email client
await openURL("mailto:hello@example.com");Determines whether an installed app can handle a given URL.
/**
* Determine whether or not an installed app can handle a given URL.
* On web this always returns true because there is no API for detecting what URLs can be opened.
* @param url - The URL that you want to test can be opened
* @returns Promise that resolves with true if URL can be handled, false if not
* The Promise will reject on Android if impossible to check, and on iOS if you didn't add the specific scheme in LSApplicationQueriesSchemes
*/
function canOpenURL(url: string): Promise<boolean>;Usage Example:
import { canOpenURL, openURL } from "expo-linking";
const url = "instagram://user?username=expo";
try {
if (await canOpenURL(url)) {
await openURL(url);
} else {
// Fallback to web version
await openURL("https://instagram.com/expo");
}
} catch (error) {
console.log("Error checking URL support:", error);
// Error cases:
// - On Android: Impossible to check URL support
// - On iOS: Scheme not in LSApplicationQueriesSchemes
// - Malformed URL
}Retrieves the URL that was used to launch the app.
/**
* Get the URL that was used to launch the app if it was launched by a link.
* @returns The URL string that launched your app, or null if not launched via link
*/
function getInitialURL(): Promise<string | null>;Usage Example:
import { getInitialURL } from "expo-linking";
const initialUrl = await getInitialURL();
if (initialUrl) {
console.log("App launched with URL:", initialUrl);
// Handle the initial deep link
} else {
console.log("App launched normally");
}Synchronously gets the current linking URL using Expo's implementation.
/**
* Get the URL that was used to launch the app if it was launched by a link.
* Expo-specific synchronous implementation.
* @returns The URL string that launched your app, or null
*/
function getLinkingURL(): string | null;Usage Example:
import { getLinkingURL } from "expo-linking";
// Synchronous call - useful in Expo environments
const linkingUrl = getLinkingURL();
if (linkingUrl) {
console.log("Current linking URL:", linkingUrl);
}Launch an Android intent with extras (Android-only, deprecated).
/**
* Launch an Android intent with extras.
* @deprecated Use expo-intent-launcher instead. Only included for React Native Linking API compatibility.
* @platform android
* @param action - The intent action
* @param extras - Array of key-value pairs to pass as intent extras
*/
function sendIntent(action: string, extras?: SendIntentExtras[]): Promise<void>;
interface SendIntentExtras {
key: string;
value: string | number | boolean;
}Usage Example:
import { sendIntent } from "expo-linking";
import { Platform } from "react-native";
if (Platform.OS === "android") {
await sendIntent("android.intent.action.VIEW", [
{ key: "url", value: "https://example.com" }
]);
}Opens the device settings app to show the app's custom settings.
/**
* Open the operating system settings app and displays the app's custom settings, if it has any.
* @throws UnavailabilityError on web platform
*/
function openSettings(): Promise<void>;Usage Example:
import { openSettings } from "expo-linking";
try {
await openSettings();
} catch (error) {
console.log("Cannot open settings on this platform");
}