Miniapp APIs
Clipboard
Read from and write to the system clipboard with Nebula APIs.
Read the clipboard
import { getClipboardData } from '@nebula-rn/client';
const text = await getClipboardData();
console.log('Clipboard content:', text);Write to the clipboard
import { setClipboardData } from '@nebula-rn/client';
await setClipboardData('Copied text content');Example: copy a share link
import React from 'react';
import { Text, TouchableOpacity, Alert } from 'react-native';
import { setClipboardData } from '@nebula-rn/client';
export default function ShareButton({ link }: { link: string }) {
const handleCopy = async () => {
await setClipboardData(link);
Alert.alert('Copied', 'The link has been copied to the clipboard.');
};
return (
<TouchableOpacity onPress={handleCopy}>
<Text>Copy link</Text>
</TouchableOpacity>
);
}