Skip to content

Instantly share code, notes, and snippets.

@AurangzaibRamzan
Created July 15, 2019 09:55
Show Gist options
  • Save AurangzaibRamzan/847890f1ec4517a582f10442d7d2a582 to your computer and use it in GitHub Desktop.
Save AurangzaibRamzan/847890f1ec4517a582f10442d7d2a582 to your computer and use it in GitHub Desktop.
Alert on Clipboard Copy Text
import React from 'react';
import PropTypes from 'prop-types';
import { Clipboard, Alert, TouchableOpacity, View, Text } from 'react-native';
export default class ClipboardView extends React.Component {
onPressHandler = async () => {
await Clipboard.setString('mail@mail.com');
Alert.alert('Copied');
};
render() {
return (
<TouchableOpacity onPress={() => this.onPressHandler()} >
<View>
<Text style={{ color: 'grey', fontSize: 20, fontFamily: 'arial', fontStyle: 'bold', textAlign: 'center', marginTop: 3, marginLeft: 25, marginBottom: 17 }}>mail@mail.com</Text>
</View>
</TouchableOpacity>
);
}
}
Clipboard.propTypes = {
text: PropTypes.string,
};
@AurangzaibRamzan
Copy link
Author

Screenshot_1563184560
Screenshot_1563184563

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment