← All @molecule/* packages · App templates
@molecule/app-clipboard-react-nativeProvider bond · clipboard · App (browser) · v1.0.1 · Apache-2.0
React Native clipboard provider
npm install @molecule/app-clipboard-react-nativenpm · Source on GitHub · Implements @molecule/app-clipboard
@molecule/app-clipboard-react-native is a provider bond on the app (browser) side: it implements the clipboard core interface (@molecule/app-clipboard) with a concrete vendor or library behind it.
Your code calls the core; you wire this provider once at startup. Swapping vendors later is one line in that wiring, not a rewrite.
import { setProvider } from '@molecule/app-clipboard'
import { provider } from '@molecule/app-clipboard-react-native'
setProvider(provider)Auto-generated, AI-first package reference for the molecule.dev ecosystem. It is written to be read by coding agents as much as by people, and is generated from this package's source — edit
src/index.tsJSDoc, not this file.
React Native clipboard provider for molecule.dev.
Uses @react-native-clipboard/clipboard to implement the ClipboardProvider interface
from @molecule/app-clipboard.
import { setProvider } from '@molecule/app-clipboard'
import { provider } from '@molecule/app-clipboard-react-native'
setProvider(provider)
provider
npm install @molecule/app-clipboard-react-native @molecule/app-clipboard @molecule/app-i18n @molecule/app-logger @react-native-clipboard/clipboard
ReactNativeClipboardConfigConfiguration for the React Native clipboard provider.
interface ReactNativeClipboardConfig {
/**
* Whether to poll for clipboard changes (text-diff polling, works on all platforms). Without it, onChange() returns a no-op unsubscribe.
* @default false
*/
pollForChanges?: boolean
/**
* Polling interval in milliseconds (if pollForChanges is true).
* @default 1000
*/
pollInterval?: number
}
createReactNativeClipboardProvider(config)Creates a React Native clipboard provider backed by @react-native-clipboard/clipboard.
function createReactNativeClipboardProvider(config?: ReactNativeClipboardConfig): ClipboardProvider
config — Optional provider configuration.Returns: A ClipboardProvider implementation for React Native.
providerDefault React Native clipboard provider.
const provider: ClipboardProvider
Implements @molecule/app-clipboard interface.
Setup function to register this provider with the core interface:
import { setProvider } from '@molecule/app-clipboard'
import { provider } from '@molecule/app-clipboard-react-native'
export function setupNativeClipboardReactNative(): void {
setProvider(provider)
}
Peer dependencies:
@molecule/app-clipboard ^1.0.1@molecule/app-i18n ^1.0.1@molecule/app-logger ^1.0.1@react-native-clipboard/clipboard >=1.13.0@molecule/app-clipboard@molecule/app-i18n@molecule/app-logger@react-native-clipboard/clipboardPlatform limits of the underlying @react-native-clipboard/clipboard
(installed separately; the first clipboard call throws an actionable
error naming it if missing):
writeHtml()/write({ html }) write the markup
as PLAIN TEXT, and readHtml() always resolves null.writeImage()/readImage() work only where the native module
supports them (iOS) and only with base64 strings — elsewhere (Android,
Blob input) they silently no-op / return null. Check
getCapabilities().canWriteImage before showing a copy-image action.onChange() fires only with createReactNativeClipboardProvider({ pollForChanges: true }) — the bare provider export has it OFF and
returns a no-op unsubscribe.Translation strings are provided by @molecule/app-locales-clipboard.