Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
@react-x/clipboard
Advanced tools
Readme
Cross-platform clipboard for ReactDOM and React Native apps.
Install @react-x/clipboard
using yarn
:
yarn add @react-x/clipboard
import React from 'react';
import PropTypes from 'prop-types';
import {Text, Touchable, View} from 'react-native';
import Clipboard from '@react-x/clipboard';
class App extends React.Component {
// --------------------------------------------------
// Props
// --------------------------------------------------
static propTypes = {
user: PropTypes.object.isRequired,
};
static defaultProps = {
};
// --------------------------------------------------
// Event Handlers
// --------------------------------------------------
@bind
handlePress() {
Clipboard.setString(this.props.user.name);
}
// --------------------------------------------------
// Render
// --------------------------------------------------
render() {
return (
<View>
...
<Touchable
onPress={this.handlePress}>
<Text>
{'Copy Name'}
</Text>
</Touchable>
</View>
);
}
}
async getString
Returns a promise that resolves to the string currently copied to the clipboard. This currently is not supported on the DOM version. Please submit a PR with this functionality!
async setString(string)
Copies the string
to the clipboard.
If you have any ideas on how this module could be better, create an Issue or submit a PR.
FAQs
Cross-platform clipboard for ReactDOM and React Native apps.
The npm package @react-x/clipboard receives a total of 116 weekly downloads. As such, @react-x/clipboard popularity was classified as not popular.
We found that @react-x/clipboard demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.