Added toast on copy
This commit is contained in:
		
							parent
							
								
									05c4a573f8
								
							
						
					
					
						commit
						4e34f2ce37
					
				| @ -1,6 +1,7 @@ | |||||||
| import React from 'react'; | import React from 'react'; | ||||||
| import { View, Text, Clipboard } from 'react-native'; | import { View, Text, Clipboard } from 'react-native'; | ||||||
| import IconVector from 'react-native-vector-icons/FontAwesome5'; | import IconVector from 'react-native-vector-icons/FontAwesome5'; | ||||||
|  | import Toast from 'react-native-simple-toast'; | ||||||
| 
 | 
 | ||||||
| export default class ClipElement extends React.Component<any, any> { | export default class ClipElement extends React.Component<any, any> { | ||||||
| 
 | 
 | ||||||
| @ -8,10 +9,15 @@ export default class ClipElement extends React.Component<any, any> { | |||||||
|         super(props); |         super(props); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     onCopy() { | ||||||
|  |         Clipboard.setString(this.props.title); | ||||||
|  |         Toast.show('Put "' + this.props.title + '" in clipboard', Toast.SHORT); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     render(): JSX.Element { |     render(): JSX.Element { | ||||||
|         return <View style={{flex:1,margin:10,flexDirection:'row',justifyContent:'space-between',alignItems:'center'}}> |         return <View style={{flex:1,margin:10,flexDirection:'row',justifyContent:'space-between',alignItems:'center'}}> | ||||||
|             <Text style={{fontSize:20,}}>{this.props.title}</Text> |             <Text style={{fontSize:20,}}>{this.props.title}</Text> | ||||||
|             <IconVector name="clipboard" size={40} onPress={() => Clipboard.setString(this.props.title)} /> |             <IconVector name="clipboard" size={40} onPress={() => this.onCopy()} /> | ||||||
|         </View>; |         </View>; | ||||||
|     } |     } | ||||||
| } | } | ||||||
| @ -15,6 +15,7 @@ | |||||||
|     "expo-cli": "^6.3.2", |     "expo-cli": "^6.3.2", | ||||||
|     "react": "18.2.0", |     "react": "18.2.0", | ||||||
|     "react-native": "0.71.4", |     "react-native": "0.71.4", | ||||||
|  |     "react-native-simple-toast": "^2.0.0", | ||||||
|     "react-native-vector-icons": "^9.2.0" |     "react-native-vector-icons": "^9.2.0" | ||||||
|   }, |   }, | ||||||
|   "devDependencies": { |   "devDependencies": { | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user