React Native Copy to Clipboard Example

Jun 21, 2022 . Admin

Hi Guys,

In this example, you will learn react native copy to clipboard example. let’s discuss about how to creat copy to clipboard in react native. if you have question about how to implement copy to clipboard in react native then I will give simple example with solution. I would like to share with you copy to clipboard example in react native. You just need to some step to done how to copy text to clipboard in react-native.

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

#React Native