react-x-clipboard
Cross-platform clipboard for ReactDOM and React Native apps.
Getting Started
Install react-x-clipboard
using yarn
:
yarn add react-x-clipboard
Usage
;;;; Component // -------------------------------------------------- // Props // -------------------------------------------------- static propTypes = user: PropTypesobjectisRequired ; static defaultProps = ; // -------------------------------------------------- // Event Handlers // -------------------------------------------------- @bind { Clipboard; } // -------------------------------------------------- // Render // -------------------------------------------------- { return <View> ... <Touchable onPress=thishandlePress> <Text> 'Copy Name' </Text> </Touchable> </View> ; }
API
async getString
Returns a promise that resolves to the string currently copied to the clipboard. This currently is not supported on the DOM version. Please submit a PR with this functionality!
async setString(string)
Copies the string
to the clipboard.
Contributing
If you have any ideas on how this module could be better, create an Issue or submit a PR.