[BREAKGLASS] Append-only mirror of github.com/bluewallet/clipboard
Go to file
2020-01-29 01:23:10 +09:00
.circleci chore: use community circle ci orb 2020-01-20 17:40:18 +09:00
.github completely migrated Clipboard Api and tested in the example app 2019-02-28 16:22:55 +05:00
android fix: android package 2020-01-29 01:22:54 +09:00
example chore: apply lint 2019-12-30 11:18:02 +09:00
ios feat rename module from RCTClipboard to RNCClipboard 2020-01-03 13:40:31 +09:00
js chore: split files to NativeModule and component 2020-01-29 01:23:10 +09:00
screenshots android screenshot added. 2019-02-28 16:33:51 +05:00
.eslintignore completely migrated Clipboard Api and tested in the example app 2019-02-28 16:22:55 +05:00
.eslintrc.js chore: add eslint and prettier 2019-12-30 11:17:42 +09:00
.flowconfig chore: update flow 2020-01-20 17:54:28 +09:00
.gitattributes migrating Clipboard from RN core to community version 2019-02-14 20:01:28 +05:00
.gitignore migrating Clipboard from RN core to community version 2019-02-14 20:01:28 +05:00
.npmignore added screenshot. 2019-02-28 16:25:42 +05:00
.prettierrc.js chore: add eslint and prettier 2019-12-30 11:17:42 +09:00
.releaserc completely migrated Clipboard Api and tested in the example app 2019-02-28 16:22:55 +05:00
babel.config.js chore: apply lint 2019-12-30 11:18:02 +09:00
CONTRIBUTING.md chore: fix contributing.md 2019-12-31 12:41:45 +09:00
index.d.ts feat: add TypeScript support 2019-03-01 10:31:35 +01:00
LICENSE migrating Clipboard from RN core to community version 2019-02-14 20:01:28 +05:00
package.json chore: update flow 2020-01-20 17:54:28 +09:00
README.md docs: add linking instructions 2020-01-21 15:30:55 +09:00
RNCClipboard.podspec feat rename module from RCTClipboard to RNCClipboard 2020-01-03 13:40:31 +09:00
tsconfig.json chore: add type-checking script 2020-01-20 17:01:16 +09:00
yarn.lock chore: update flow 2020-01-20 17:54:28 +09:00

@react-native-clipboard

Lean Core Extracted

React Native Clipboard API for both iOS and Android

Screenshot

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
  • React Native v0.60+

For iOS, use cocoapods to link the package.

run the following command:

$ cd ios && pod install

For android, the package will be linked automatically on build.

  • React Native <= 0.59

run the following command to link the package:

$ react-native link @react-native-community/react-native-clipboard

or you could follow the instructions to manually link the project

Upgrading to React Native 0.60+

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-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.