expo-linking
@amazon-devices/expo-linking
provides utilities for your app to interact with other installed apps using deep links. It also provides helper methods for constructing and parsing deep links into your app. This module is an extension of the React Native Linking module.
Installation
- Add the JavaScript library dependency in the
package.json
file.dependencies: { ... "@amazon-devices/expo-linking": "~2.0.0", "expo": "~50.0.0", ... }
- Reinstall dependencies using
npm install
command.
Examples
import * as Linking from '@amazon-devices/expo-linking';
import React, {useEffect, useState} from 'react';
import {Button, StyleSheet, Text, View} from 'react-native';
const URL = 'pkg://com.amazondeveloper.uisvg-demo.main';
export const App = () => {
const [parsedUrl, setParsedUrl] = useState<string | null>(null);
useEffect(() => {
const parsed = Linking.parse(URL);
setParsedUrl(JSON.stringify(parsed, null, 2));
}, []);
const onLinking = async () => {
const supported = await Linking.canOpenURL(URL);
if (supported) {
await Linking.openURL(URL);
}
};
return (
<View style={styles.container}>
{parsedUrl && <Text style={styles.text}>{parsedUrl}</Text>}
<Button title="Link to application" onPress={onLinking} />
</View>
);
};
const styles = StyleSheet.create({
container: {
backgroundColor: 'white',
flex: 1,
},
text: {
color: 'black',
fontSize: 32,
},
});
API reference
Check out the dedicated documentation page for info about this library, API reference and more: Official Expo documentation for expo-linking.
Hooks
Hook | Description |
---|---|
useURL |
Returns the initial URL followed by any subsequent changes to the URL |
Methods
Method | Description |
---|---|
canOpenURL |
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 |
collectManifestSchemes |
Collect a list of platform schemes from the manifest. This method is based on the Scheme modules from @expo/config-plugins which are used for collecting the schemes before prebuilding a native app |
createURL |
Helper method for constructing a deep link into your app, given an optional path and set of query parameters. Creates a URI scheme with two slashes by default. The scheme in bare and standalone must be defined in the Expo config (app.config.js or app.json ) under expo.scheme |
getInitialURL |
Get the URL that was used to launch the app if it was launched by a link |
hasConstantsManifest |
Ensure the user has linked the expo-constants manifest in bare workflow |
hasCustomScheme |
Returns whether the application has been configured with a custom scheme |
openSettings |
Open the operating system settings app and displays the app’s custom settings, if it has any |
openURL |
Attempt to open the given URL with an installed app |
parse |
Helper method for parsing out deep link information from a URL |
parseInitialURLAsync |
Helper method which wraps React Native's Linking.getInitialURL() in Linking.parse() . Parses the deep link information out of the URL used to open the experience initially. If no link opened the app, all the fields will be null |
resolveScheme |
Returns a string representing the resolved scheme. If a custom scheme is configured, it will return that scheme |
Event subscriptions
Subscription | Description |
---|---|
addEventListener |
Add a handler to Linking changes by listening to the url event type and providing the handler. It is recommended to use the useURL() hook instead |
Supported versions
Package Version | Based On | @amazon-devices/react-native-kepler version |
---|---|---|
2.0.x | 6.1.1 | 2.0.x |
Additional resources
For information on additional libraries, see Supported Third-Party Libraries and Services.
Last updated: Sep 30, 2025