Matthias Nott
2026-03-07 5db84bd89c8808b0895c7206e8a6a58043f9f8dc
components/chat/ImageViewer.tsx
....@@ -10,6 +10,7 @@
1010 View,
1111 } from "react-native";
1212 import { cacheDirectory, writeAsStringAsync } from "expo-file-system/legacy";
13
+import * as Clipboard from "expo-clipboard";
1314 import * as Sharing from "expo-sharing";
1415
1516 /** Apple-style share icon (square with upward arrow) */
....@@ -68,6 +69,14 @@
6869 export function ImageViewer({ visible, imageBase64, onClose }: ImageViewerProps) {
6970 const { width, height } = Dimensions.get("window");
7071
72
+ const handleCopy = useCallback(async () => {
73
+ try {
74
+ await Clipboard.setImageAsync(`data:image/png;base64,${imageBase64}`);
75
+ } catch (err: any) {
76
+ Alert.alert("Copy Error", err?.message ?? String(err));
77
+ }
78
+ }, [imageBase64]);
79
+
7180 const handleShare = useCallback(async () => {
7281 try {
7382 const fileUri = `${cacheDirectory}pailot-screenshot-${Date.now()}.png`;
....@@ -105,6 +114,20 @@
105114 }}
106115 >
107116 <Pressable
117
+ onPress={handleCopy}
118
+ hitSlop={{ top: 12, bottom: 12, left: 12, right: 12 }}
119
+ style={{
120
+ width: 40,
121
+ height: 40,
122
+ borderRadius: 20,
123
+ backgroundColor: "rgba(255,255,255,0.15)",
124
+ alignItems: "center",
125
+ justifyContent: "center",
126
+ }}
127
+ >
128
+ <Text style={{ color: "#fff", fontSize: 18 }}>📋</Text>
129
+ </Pressable>
130
+ <Pressable
108131 onPress={handleShare}
109132 hitSlop={{ top: 12, bottom: 12, left: 12, right: 12 }}
110133 style={{