Share API allows you to share text content and URLs using the native share dialog on both iOS and Android.
Methods
share()
url or message:
url(string, required on iOS): A URL to sharemessage(string, required on Android): A message to share (often includes a URL)title(string, Android only): Title of the message
-
iOS:
subject(string): Subject to share via emailexcludedActivityTypes(string[]): Activities to exclude from the share sheettintColor(ColorValue): Tint color of the share sheetanchor(number): iPad only - anchor point for the popover
-
Android:
dialogTitle(string): Title of the share dialog
action(string): EitherShare.sharedActionorShare.dismissedAction(iOS only)activityType(string | null): The activity type that was used to share (iOS only)
Constants
Share.sharedAction
The content was successfully shared.
Share.dismissedAction
iOS only - The share dialog was dismissed without sharing.
Platform Behavior
iOS
- Returns a Promise that resolves with
actionandactivityType - If dismissed, the Promise still resolves with
actionbeingShare.dismissedAction - At least one of
urlormessageis required - The
subjectoption is used for email sharing
Android
- Returns a Promise that always resolves with
actionbeingShare.sharedAction activityTypeis alwaysnull- The
messagefield is required and often includes the URL - Uses Android’s native share intent