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

@react-native-community/react-native-clipboard

Package Overview
Dependencies
Maintainers
18
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@react-native-community/react-native-clipboard

React Native Clipboard API for both iOS and Android

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
18
Created
Source

@react-native-clipboard

Getting started

Install the library using either Yarn:

yarn add @react-native-community/react-native-clipboard

or npm:

npm install --save @react-native-community/react-native-clipboard

Migrating from the core react-native module

This module was created when the NetInfo 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:

import { Clipboard } from "react-native";

to:

import Clipboard from "@react-native-community/react-native-clipboard";

Usage

Start by importing the library:

import Clipboard from "@react-native-community/react-native-clipboard";

type Props = $ReadOnly<{||}>;
type State = {|
  clipboardContent: string,
|};

export default class App extends React.Component<Props, State> {
  state = {
    clipboardContent: 'The state variable which contains Clipboard Content',
  };

  readFromClipboard = async () => {
    const content = await Clipboard.getString();
    this.setState({clipboardContent: content});
  };

  writeToClipboard = async () => {
    Clipboard.setString(this.state.text);
    alert('Copied to clipboard');
  };
}

Maintainers

  • M.Haris Baig

Contributing

Please see the contributing guide.

License

The library is released under the MIT licence. For more information see LICENSE.

Keywords

FAQs

Package last updated on 28 Feb 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