Copy text to your clipboard
Update This is now supported out of the box in React-Native. You no longer need this module. I'll leave it up here just for history :)
- Run
npm install react-native-pasteboard --save
- Open your project in XCode, right click on your project and click
Add Files to "Your Project Name"
- Add
RCTPasteBoard
from yournode_modules/react-native-pasteboard
folder. - Whenever you want to use it within React Native code now you can:
var PasteBoard = require('react-native-pasteboard');
var PasteBoard = require('react-native-pasteboard');
PasteBoard.copyText('Hello world!' , (callback) => {
AlertIOS.alert('Alert', 'Link copied to clipboard!');
});
copyText(input, callback)
Callback is required.