@solidnative-dev/clipboard

Bounded, privacy-safe text clipboard access for Solid Native applications. Drives React Native's Clipboard TurboModule directly without evaluating Clipboard.js or NativeClipboard.js.

Installation#

sh
pnpm add @solidnative-dev/clipboard

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

Usage#

ts
import { createReactNativeClipboardService } from "@solidnative-dev/clipboard/react-native";
import { createClipboardController } from "@solidnative-dev/clipboard/solid";

const clipboard = createClipboardController(
  createReactNativeClipboardService(),
);

clipboard.writeText("Rendered by Solid");
const text = await clipboard.readText();
clipboard.clear();

Entrypoints#

ImportKey exports
@solidnative-dev/clipboardcreateClipboardService, ClipboardService, ClipboardAdapter, CLIPBOARD_MAX_TEXT_LENGTH (1048576)
@solidnative-dev/clipboard/react-nativecreateReactNativeClipboardService
@solidnative-dev/clipboard/solidcreateClipboardController, SolidClipboardController, ClipboardOwnerDisposedError

Behavior & platform notes#

  • Size bounds: Both writes and reads are bounded to 1 Mi UTF-16 code units. Empty text is valid, and clear() writes an empty string explicitly.
  • Explicit reads & privacy: The clipboard is only read when application code calls readText(). Read settlements enter observability as default-priority causal events without ever recording clipboard text.
  • Owner disposal: Disposing the current Solid owner rejects pending reads with ClipboardOwnerDisposedError and disables further reads and writes on that controller.