Skip to content

Clipboard interaction is now in the React Native core #5

@ltk

Description

@ltk

Just a note to others that a Clipboard API has been part of RN core since version 0.17: https://github.com/facebook/react-native/blob/master/Libraries/Components/Clipboard/Clipboard.js (It will be included in the React Native documentation site soon.)

Usage is as follows:

import { Clipboard } from 'react-native';

Clipboard.setString('clipboard-contents');

async _getContent() {
   var content = await Clipboard.getString(); // getString() returns a Promise
 }

It could be worth a brief note in the README that no external clipboard dependency is needed if using a newer version of RN.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions