Share API
Also called Share sheet
- Part of
- React Native Glossary
- Updated
What is Share API in React Native?
Share is the React Native API that opens the native share sheet so users can send a message or link to other apps, returning a promise that reports the outcome.
Share is the core API that opens the system share sheet: the UIActivityViewController on iOS and the Android share chooser. One call lets the user send content to Messages, WhatsApp, email, notes or any app that accepts shares.
const result = await Share.share({
message: 'Join me on the app',
url: 'https://example.com/invite/abc', // iOS only
title: 'Invite', // Android only
});
if (result.action === Share.sharedAction) track('invite_shared');
The content object is less portable than it looks:
messageworks on both platforms and is the safe default.urlis iOS only. On Android it is ignored, so put the link insidemessageif it must appear everywhere.titleis Android only and sets the chooser’s title;subjectis used by email targets.- iOS-specific options include
excludedActivityTypesto hide targets such as “Add to Reading List”.
The returned promise resolves with sharedAction or dismissedAction. That result is not reliable analytics on Android, where the promise always resolves with sharedAction, whether or not the user actually sent anything. iOS can also tell you which activity was chosen.
The biggest limitation is files. The core API shares text and links, not images, PDFs or videos from local storage on Android. For that, use expo-sharing from Expo, which shares a local file URI on both platforms, or the community library react-native-share for richer options.
Shared links are only useful if they open the right screen. Pair the share sheet with proper deep linking, ideally verified https links, so a recipient who taps an invite lands inside the app, or on a web page when it is not installed, rather than on a dead custom scheme.