This documentation is available as Markdown for AI agents and LLMs. See the full Markdown index or append .md to any documentation URL.

Expo Clipboard iconExpo Clipboard

A universal library that allows getting and setting Clipboard content.

Android
iOS
Web
Included in Expo Go
Recommended version:
~56.0.4

expo-clipboard provides an interface for getting and setting Clipboard content on Android, iOS, and Web.

Installation

Terminal
- npx expo install expo-clipboard
- yarn expo install expo-clipboard
- pnpm expo install expo-clipboard
- bun expo install expo-clipboard

If you are installing this in an existing React Native app, make sure to install expo in your project.

Usage

Clipboard
import { useState } from 'react'; import { View, Text, Button, StyleSheet } from 'react-native'; import * as Clipboard from 'expo-clipboard'; export default function App() { const [copiedText, setCopiedText] = useState(''); const copyToClipboard = async () => { await Clipboard.setStringAsync('hello world'); }; const fetchCopiedText = async () => { const text = await Clipboard.getStringAsync(); setCopiedText(text); }; return ( <View style={styles.container}> <Button title="Click here to copy to Clipboard" onPress={copyToClipboard} /> <Button title="View copied text" onPress={fetchCopiedText} /> <Text style={styles.copiedText}>{copiedText}</Text> </View> ); } const styles = StyleSheet.create({ container: { flex: 1, justifyContent: 'center', alignItems: 'center', }, copiedText: { marginTop: 10, color: 'red', }, });

API

import * as Clipboard from 'expo-clipboard';

No API data file found, sorry!