React Native · APIs and utilities
Share
System share sheet.
4 exports
Import
TSX
import { Share } from "@yasinsensoy/native";Share
moduleSystem share sheet.
| Name | Type | Description |
|---|---|---|
share | (content: ShareContent, options?: ShareOptions) => Promise<ShareResult> | Opens the share sheet; resolves when the user picks a target or closes it. Errors: E_ARGS (no content), E_FILE (file missing), E_NO_ACTIVITY. |
ShareContent
interfaceContent to share. At least one must be given.
| Name | Type | Description |
|---|---|---|
message? | string | Text. |
url? | string | Link (appended to the text on Android). |
files? | readonly string[] | Files: a file:// URL or an absolute path; on Android also content://. On Android they are copied to the cache and opened to the chosen app only. |
subject? | string | Subject (email). If title is given without subject, it is used. |
title? | string | Title. |
mimeType? | string | Android: MIME type. Inferred from the files if omitted (text/plain). |
ShareOptions
interfaceShare.share options.
| Name | Type | Description |
|---|---|---|
dialogTitle? | string | Android: title of the share sheet. |
excludedActivityTypes? | readonly string[] | iOS: targets to hide (airDrop, message, mail, copy, print, assignToContact, saveToCameraRoll, addToReadingList, openInIBooks, markupAsPDF or a system id). |
anchor? | { x: number; y: number; width?: number; height?: number; } | iPad: area the popover anchors to (screen points). Opens centered if omitted. |
ShareResult
interfaceShare result.
| Name | Type | Description |
|---|---|---|
action | "shared" | "dismissed" | shared: a target was chosen; dismissed: the sheet was closed. |
target | string | null | The chosen target (Android: package name, iOS: activity type). null if unknown or a system action ("Copy" on Android). |