Created
July 15, 2019 09:55
-
-
Save AurangzaibRamzan/847890f1ec4517a582f10442d7d2a582 to your computer and use it in GitHub Desktop.
Alert on Clipboard Copy Text
This file contains 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
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, | |
}; |
Author
AurangzaibRamzan
commented
Jul 15, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment