Guides
Plan-enterprise-icon
Expo Application Services
API Reference

Sharing

expo-sharing allows you to share files directly with other compatible applications.

Platform Compatibility

Android DeviceAndroid EmulatoriOS DeviceiOS SimulatorWeb
Status-success-iconStatus-success-iconStatus-success-iconStatus-success-iconStatus-success-icon

Sharing limitations on web

  • 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().
  • HTTPS required on web: The Web Share API is only available on web when the page is served over https. Run your app with expo start --https to enable it.
  • No local file sharing on web: Sharing local files by URI works on iOS and Android, but not on web. You cannot share local files on web by URI — you will need to upload them somewhere and share that URI.

Sharing to your app from other apps

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. If you are using the bare workflow you can build this functionality on your own, but it is not available in the managed workflow.

Installation

Terminal
→ npx expo install expo-sharing

If you're installing this in a bare React Native app, you should also follow these additional installation instructions.

API

import * as Sharing from 'expo-sharing';

Methods

Sharing.isAvailableAsync()

Determine if the sharing API can be used in this app.

  • Undo-iconPromise<boolean>

A promise that fulfills with true if the sharing API can be used, and false otherwise.

Sharing.shareAsync(url, options)

NameTypeDescription
urlstring

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.

Types

SharingOptions

NameTypeDescription
UTI
(optional)
stringOnly for:
Apple-iconiOS

Uniform Type Identifier
  • the type of the target file.
dialogTitle
(optional)
stringOnly for:
Android-iconAndroid
At-sign-iconWeb

Sets share dialog title.
mimeType
(optional)
stringOnly for:
Android-iconAndroid

Sets mimeType for Intent.
  • Message-iconAsk a question on the forums about Sharing
  • Github-iconView open bug reports for Sharing
  • Code-iconView source code for Sharing
  • Build-iconView package in npm Registry
  • Edit-iconEdit this page

Was this doc helpful?