Last active
March 1, 2019 09:18
-
-
Save michalchudziak/2df97c7da3f3e818567499718ab5e283 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* @flow */ | |
| import React, {useState, useEffect} from 'react'; | |
| import {NativeModules} from 'react-native'; | |
| export default function useClipboard() { | |
| const [contents, setContents] = useState(''); | |
| const setClipboardContents = (content) => { | |
| NativeModules.Clipboard.setString(content); | |
| setContents(content); | |
| }; | |
| return [contents, setClipboardContents]; | |
| }; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment