@solidnative-dev/sharing

Validated system sharing for Solid Native applications. Drives React Native's Android ShareModule and iOS ActionSheetManager TurboModules directly without evaluating Libraries/Share/Share.js.

Installation#

sh
pnpm add @solidnative-dev/sharing

No extra native dependency is required—uses React Native's built-in sharing TurboModules.

Usage#

ts
import { createReactNativeShareService } from "@solidnative-dev/sharing/react-native";
import { createShareController } from "@solidnative-dev/sharing/solid";

const sharing = createShareController(createReactNativeShareService());
const result = await sharing.share({
  message: "A native app rendered by Solid",
  url: "https://solidnative.dev",
  subject: "Solid Native",
});

Entrypoints#

ImportKey exports
@solidnative-dev/sharingcreateShareService, ShareService, ShareRequest, ShareResult, SharePresentationInProgressError
@solidnative-dev/sharing/react-nativecreateReactNativeShareService, SharePresentationInProgressError
@solidnative-dev/sharing/solidcreateShareController, SolidShareController, ShareOwnerDisposedError, SharePresentationInProgressError

Behavior & platform notes#

  • Truthful platform results:
    • Android returns { action: "presented" } once the system chooser launches (Android does not report whether the user completed or dismissed the share).
    • iOS returns { action: "completed", activityType? } or { action: "dismissed" }.
  • URL handling on Android: When both message and url (or url alone) are provided on Android, the URL is included in the shared text instead of being dropped. On iOS, message and URL stay separate activity items.
  • Validation & single sheet: Strings and URLs are bounded and validated before presentation, and overlapping share sheets reject with SharePresentationInProgressError.
  • Owner disposal & privacy: Disposing the Solid owner rejects pending shares with ShareOwnerDisposedError. Message, URL, subject, and activity type are never recorded in causal telemetry.