This is documentation for the next SDK version. For up-to-date documentation, see the latest version (SDK 52).
A library that provides implementing sharing files.
expo-sharing
allows you to share files directly with other compatible applications.
expo-sharing
for web is built on top of the Web Share API, which still has very limited browser support. Be sure to check that the API can be used before calling it by using Sharing.isAvailableAsync()
.npx expo start --https
to enable it.Currently expo-sharing
only supports sharing from your app to other apps and you cannot register to your app to have content shared to it through the native share dialog on native platforms. You can read more in the related feature request. You can setup this functionality manually in Xcode and Android Studio and create an Expo Config Plugin to continue using Expo Prebuild.
-
npx expo install expo-sharing
If you are installing this in an existing React Native app, start by installing expo
in your project. Then, follow the additional instructions as mentioned by the library's README under "Installation in bare React Native projects" section.
import * as Sharing from 'expo-sharing';
Determine if the sharing API can be used in this app.
Promise<boolean>
A promise that fulfills with true
if the sharing API can be used, and false
otherwise.
Parameter | Type | Description |
---|---|---|
url | string | Local file URL to share. |
options(optional) | SharingOptions | A map of share options. Default: {} |
Opens action sheet to share file to different applications which can handle this type of file.
Promise<void>
Property | Type | Description |
---|---|---|
dialogTitle(optional) | string | Only for: Android Web Sets share dialog title. |
mimeType(optional) | string | Only for: Android Sets |
UTI(optional) | string |