Skip to main content

expo-sharing

Version: 55.0.7 Provides a way to share files directly with other compatible applications. Uses the native share sheet on iOS and Android to allow users to share content with apps like Messages, Mail, social media, and more.

Installation

Usage

API Reference

Methods

() => Promise<boolean>
Checks if sharing is available on the current platformReturns false on web and simulators/emulators
(url: string, options?: SharingOptions) => Promise<void>
Opens the native share sheet to share a fileParameters:
  • url (string): Local file URI to share (must start with file://)
  • options (SharingOptions): Optional configuration

Types

SharingOptions

string
Title for the share dialog (Android only)
string
MIME type of the file being shared
string
iOS Uniform Type Identifier for the file

Examples

Share an Image

Share a PDF Document

Share Downloaded File

Share Camera Photo

Share JSON Data as File

Share with Error Handling

Complete Sharing Example

Platform Support

Sharing is not available on web browsers. On iOS simulators and Android emulators, isAvailableAsync() may return false.

Common MIME Types

Best Practices

  1. Check Availability: Always call isAvailableAsync() before sharing
  2. Local Files Only: Only share local file URIs (starting with file://)
  3. MIME Types: Provide correct MIME type for better app compatibility
  4. Error Handling: Wrap shareAsync() in try/catch for robust error handling
  5. File Persistence: Ensure files exist before sharing
Only local file URIs can be shared. Remote URLs must be downloaded first using expo-file-system.

Resources