Skip to content

harisbaig100/react-native-clipboard

This branch is 231 commits behind react-native-clipboard/clipboard:master.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

1c4a81e · Feb 28, 2019

History

7 Commits
Feb 14, 2019
Feb 28, 2019
Feb 28, 2019
Feb 28, 2019
Feb 14, 2019
Feb 28, 2019
Feb 28, 2019
Feb 28, 2019
Feb 28, 2019
Feb 14, 2019
Feb 14, 2019
Feb 14, 2019
Feb 28, 2019
Feb 28, 2019
Feb 28, 2019
Feb 14, 2019
Feb 28, 2019
Feb 28, 2019
Feb 28, 2019
Feb 28, 2019

Repository files navigation

@react-native-clipboard

React Native Clipboard API for both iOS and Android

alt text

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

Contributing

Please see the contributing guide.

License

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

About

React Native Clipboard API for both iOS and Android.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 58.5%
  • JavaScript 36.4%
  • Ruby 2.3%
  • Objective-C 1.4%
  • Python 1.4%