1.0.0 • Published 1 year ago

react-native-copy-paste v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

Copy & Paste

Example

import React from 'react';
import { View, Text, Button } from 'react-native';
import { copyToClipboard, pasteFromClipboard } from 'react-native-copy-paste';

const CopyComponent = () => {
    const handleCopy = (text) => {
        copyToClipboard(text);
    };
    const text = "Hello World";

    const handlePaste = async () => {
        await pasteFromClipboard();
    };

    return (
        <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
            <Text>Copy and Paste Example</Text>
            <Button title="Copy" onPress={handleCopy(text)} />
            <Button title="Paste" onPress={handlePaste} />
        </View>
    );
};

export default CopyComponent;

Installation

  • Can be used as npm package and:
npm i react-native-copy-paste
1.0.0

1 year ago