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/emulatorsOpens the native share sheet to share a fileParameters:
url(string): Local file URI to share (must start withfile://)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
- Check Availability: Always call
isAvailableAsync()before sharing - Local Files Only: Only share local file URIs (starting with
file://) - MIME Types: Provide correct MIME type for better app compatibility
- Error Handling: Wrap
shareAsync()in try/catch for robust error handling - File Persistence: Ensure files exist before sharing