How to use Copy to Clipboard in React Native?

Published On: 21/06/2022 | Category: React Native

Hi Guys,

I will explain step by step tutorial how to use copy to clipboard in react native. I explained simply about copy to clipboard example in react native. you can understand a concept of how to creat copy to clipboard in react native. you will learn how to implement copy to clipboard in react native. So, let's follow few step to create example of react native copy to clipboard example.

Let's start following example:

Step 1: Download Project

In the first step run the following command to create a project.

expo init ExampleApp
Step 2: Install and Setup

First, you need to install them in your project:

expo install expo-clipboard
Step 3: App.js

In this step, You will open the App.js file and put the code.

import React from 'react';
import { StyleSheet, View, Button,Text } from 'react-native';
import * as Clipboard from 'expo-clipboard';
import { TextInput } from 'react-native-paper';

const App = () => {
    const [copiedText, setCopiedText] = React.useState('');

    const copyToClipboard = async () => {
        await Clipboard.setStringAsync('');

    const fetchCopiedText = async () => {
        const text = await Clipboard.getStringAsync();

    return (
        <View style={styles.container}>
                label='Enter Text'
            <View style={styles.buttonContainer}>
                <Button title="Click here to copy to Clipboard" onPress={copyToClipboard} />
            <View style={styles.buttonContainer}>
                <Button title="View copied text" onPress={fetchCopiedText} />

const styles = StyleSheet.create({
    container: {
        paddingTop: 50,
        paddingHorizontal: 20,
    buttonContainer: {

export default App;
Run Project

In the last step run your project using the below command.

expo start

You can QR code scan in Expo Go Application on mobile.

Output :

It will help you...