Gathering detailed insights and metrics for @react-native-clipboard/clipboard
Gathering detailed insights and metrics for @react-native-clipboard/clipboard
Gathering detailed insights and metrics for @react-native-clipboard/clipboard
Gathering detailed insights and metrics for @react-native-clipboard/clipboard
@react-native-community/clipboard
React Native Clipboard API for macOS, iOS, Android, and Windows
expo-clipboard
Provides an interface for getting and setting Clipboard content on Android, iOS and Web.
@react-native-oh-tpl/clipboard
React Native Clipboard API
react-native-clipboard-toast
React Native Clipboard API with Animated toast message component
React Native Clipboard API for both iOS and Android.
npm install @react-native-clipboard/clipboard
Typescript
Module System
Node Version
NPM Version
60.4
Supply Chain
32.6
Quality
80.4
Maintenance
50
Vulnerability
93.4
License
C++ (32.91%)
TypeScript (24.7%)
Java (19.32%)
Objective-C++ (11.27%)
JavaScript (3.97%)
Ruby (3.04%)
Objective-C (2.39%)
C (1.42%)
Starlark (0.98%)
Total Downloads
33,759,600
Last Day
13,127
Last Week
367,014
Last Month
1,508,019
Last Year
15,546,438
MIT License
729 Stars
240 Commits
149 Forks
7 Watchers
11 Branches
48 Contributors
Updated on Jun 28, 2025
Minified
Minified + Gzipped
Latest Version
1.16.3
Package Id
@react-native-clipboard/clipboard@1.16.3
Unpacked Size
198.97 kB
Size
81.91 kB
File Count
68
NPM Version
10.9.2
Node Version
22.14.0
Published on
Jun 28, 2025
Cumulative downloads
Total Downloads
Last Day
36.5%
13,127
Compared to previous day
Last Week
-0.2%
367,014
Compared to previous week
Last Month
-7.4%
1,508,019
Compared to previous month
Last Year
57%
15,546,438
Compared to previous year
4
18
React Native Clipboard API for macOS, iOS, Android, and Windows.
macOS | iOS | Android | Windows |
---|---|---|---|
![]() | ![]() | ![]() | ![]() |
Install the library using either Yarn:
yarn add @react-native-clipboard/clipboard
or npm:
npm install --save @react-native-clipboard/clipboard
For iOS, use cocoapods
to link the package.
run the following command:
$ npx pod-install
For android, the package will be linked automatically on build.
run the following command to link the package:
$ react-native link @react-native-clipboard/clipboard
For iOS, make sure you install the pod file.
cd ios && pod install && cd ..
or you could follow the instructions to manually link the project
New React Native comes with autolinking
feature, which automatically links Native Modules in your project. In order to get it to work, make sure you unlink Clipboard
first:
$ react-native unlink @react-native-clipboard/clipboard
react-native
moduleThis module was created when the Clipboard API was split out from the core of React Native. To migrate to this module you need to follow the installation instructions above and then change you imports from:
1import {Clipboard} from 'react-native';
to:
1import Clipboard from '@react-native-clipboard/clipboard';
1import React, {useState} from 'react'; 2import { 3 SafeAreaView, 4 View, 5 Text, 6 TouchableOpacity, 7 StyleSheet, 8} from 'react-native'; 9import Clipboard from '@react-native-clipboard/clipboard'; 10 11const App = () => { 12 const [copiedText, setCopiedText] = useState(''); 13 14 const copyToClipboard = () => { 15 Clipboard.setString('hello world'); 16 }; 17 18 const fetchCopiedText = async () => { 19 const text = await Clipboard.getString(); 20 setCopiedText(text); 21 }; 22 23 return ( 24 <SafeAreaView style={{flex: 1}}> 25 <View style={styles.container}> 26 <TouchableOpacity onPress={copyToClipboard}> 27 <Text>Click here to copy to Clipboard</Text> 28 </TouchableOpacity> 29 <TouchableOpacity onPress={fetchCopiedText}> 30 <Text>View copied text</Text> 31 </TouchableOpacity> 32 33 <Text style={styles.copiedText}>{copiedText}</Text> 34 </View> 35 </SafeAreaView> 36 ); 37}; 38 39const styles = StyleSheet.create({ 40 container: { 41 flex: 1, 42 justifyContent: 'center', 43 alignItems: 'center', 44 }, 45 copiedText: { 46 marginTop: 10, 47 color: 'red', 48 }, 49}); 50 51export default App;
getString()
1static getString()
Get content of string type, this method returns a Promise
, so you can use following code to get clipboard content
1async _getContent() { 2 var content = await Clipboard.getString(); 3}
getStrings()
1static getStrings()
(iOS only)
Get contents of string array type, this method returns a Promise
, so you can use following code to get clipboard content
1async _getContent() { 2 var content = await Clipboard.getStrings(); 3}
setString()
1static setString(content)
Set content of string type. You can use following code to set clipboard content
1_setContent() {
2 Clipboard.setString('hello world');
3}
Name | Type | Required | Description |
---|---|---|---|
content | string | Yes | The content to be stored in the clipboard |
setStrings()
1static setStrings(content)
(iOS only) Set content of string array type. You can use following code to set clipboard content
1_setContent() {
2 Clipboard.setStrings(['hello world', 'second string']);
3}
Name | Type | Required | Description |
---|---|---|---|
content | string[] | Yes | The content to be stored in the clipboard |
hasString()
1static hasString()
Returns whether the clipboard has content or is empty. Can check if there is a content in clipboard without triggering PasteBoard notification for iOS 14+
hasURL()
1static hasURL()
(iOS only) Returns whether the clipboard has a URL content. Can check if there is a URL content in clipboard without triggering PasteBoard notification for iOS 14+
hasNumber()
1static hasNumber()
(iOS 14+ only) Returns whether the clipboard has a Number(UIPasteboardDetectionPatternNumber) content. Can check if there is a Number content in clipboard without triggering PasteBoard notification for iOS 14+
hasWebURL()
1static hasWebURL()
(iOS 14+ only) Returns whether the clipboard has a WebURL(UIPasteboardDetectionPatternProbableWebURL) content. Can check if there is a WebURL content in clipboard without triggering PasteBoard notification for iOS 14+
useClipboard
is a utility hooks for the Clipboard
module. data
contains the content stored in the clipboard.
1import React, {useEffect} from 'react'; 2import {Text} from 'react-native'; 3import {useClipboard} from '@react-native-clipboard/clipboard'; 4 5export const HooksSample = () => { 6 const [data, setString] = useClipboard(); 7 8 useEffect(() => { 9 setString('hello world'); 10 }, []); 11 12 return <Text>{data}</Text>; 13};
getImage()
1static getImage()
Get content of image in base64 string type, this method returns a Promise
, so you can use following code to get clipboard content (iOS and Android Only)
1async _getContent() { 2 var content = await Clipboard.getImage(); 3}
If you're using jest
as a test runner, you will need to setup a mock for clipboard, as NativeModules will be undefined when testing with Jest.
Create a jest.setup.js
in your project root,and set up the following to have Clipboard mocked:
1import mockClipboard from '@react-native-clipboard/clipboard/jest/clipboard-mock.js'; 2 3jest.mock('@react-native-clipboard/clipboard', () => mockClipboard);
Please see the contributing guide
.
The library is released under the MIT licence. For more information see LICENSE
.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
binaries present in source code
Details
Reason
5 existing vulnerabilities detected
Details
Reason
Found 9/25 approved changesets -- score normalized to 3
Reason
2 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 1
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-06-23
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More