Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@react-x/clipboard

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@react-x/clipboard

Cross-platform clipboard for ReactDOM and React Native apps.

  • 3.4.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
134
decreased by-55.63%
Maintainers
1
Weekly downloads
 
Created
Source

@react-x/clipboard

npm npm npm

Cross-platform clipboard for ReactDOM and React Native apps.

Getting Started

Install @react-x/clipboard using yarn:

yarn add @react-x/clipboard

Usage

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>
    );
  }

}

API

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.

Contributing

If you have any ideas on how this module could be better, create an Issue or submit a PR.

Keywords

FAQs

Package last updated on 09 Nov 2019

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc