jitsi-meet/react/features/base/util/copyText.native.ts
theluyuan 38ba663466
Some checks failed
Close stale issues and PRs / stale (push) Has been cancelled
init
2025-09-02 14:49:16 +08:00

19 lines
409 B
TypeScript

import Clipboard from '@react-native-clipboard/clipboard';
/**
* Tries to copy a given text to the clipboard.
* Returns true if the action succeeds.
*
* @param {string} textToCopy - Text to be copied.
* @returns {Promise<boolean>}
*/
export function copyText(textToCopy: string) {
try {
Clipboard.setString(textToCopy);
return true;
} catch (e) {
return false;
}
}